[VarDumper] Fix dump comparison on large arrays
This commit is contained in:
parent
0ad587aec3
commit
6a6e7f3947
@ -33,6 +33,7 @@ trait VarDumperTestTrait
|
|||||||
{
|
{
|
||||||
$h = fopen('php://memory', 'r+b');
|
$h = fopen('php://memory', 'r+b');
|
||||||
$cloner = new VarCloner();
|
$cloner = new VarCloner();
|
||||||
|
$cloner->setMaxItems(-1);
|
||||||
$dumper = new CliDumper($h);
|
$dumper = new CliDumper($h);
|
||||||
$dumper->setColors(false);
|
$dumper->setColors(false);
|
||||||
$dumper->dump($cloner->cloneVar($data)->withRefHandles(false));
|
$dumper->dump($cloner->cloneVar($data)->withRefHandles(false));
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\VarDumper\Tests\Test;
|
||||||
|
|
||||||
|
use Symfony\Component\VarDumper\Test\VarDumperTestCase;
|
||||||
|
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||||
|
|
||||||
|
class VarDumperTestTraitTest extends VarDumperTestCase
|
||||||
|
{
|
||||||
|
use VarDumperTestTrait;
|
||||||
|
|
||||||
|
public function testItComparesLargeData()
|
||||||
|
{
|
||||||
|
$howMany = 700;
|
||||||
|
$data = array_fill_keys(range(0, $howMany), array('a', 'b', 'c', 'd'));
|
||||||
|
|
||||||
|
$expected = sprintf("array:%d [\n", $howMany + 1);
|
||||||
|
for ($i = 0; $i <= $howMany; ++$i) {
|
||||||
|
$expected .= <<<EODUMP
|
||||||
|
$i => array:4 [
|
||||||
|
0 => "a"
|
||||||
|
1 => "b"
|
||||||
|
2 => "c"
|
||||||
|
3 => "d"
|
||||||
|
]\n
|
||||||
|
EODUMP;
|
||||||
|
}
|
||||||
|
$expected .= "]\n";
|
||||||
|
|
||||||
|
$this->assertDumpEquals($expected, $data);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Skipping trait tests for PHP < 5.4
|
||||||
|
if (version_compare(PHP_VERSION, '5.4.0-dev', '>=')) {
|
||||||
|
require 'VarDumpTestTraitRequire54.php';
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user