diff --git a/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php b/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php index 0d1489ab44..2d19a148d0 100644 --- a/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php +++ b/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php @@ -33,6 +33,7 @@ trait VarDumperTestTrait { $h = fopen('php://memory', 'r+b'); $cloner = new VarCloner(); + $cloner->setMaxItems(-1); $dumper = new CliDumper($h); $dumper->setColors(false); $dumper->dump($cloner->cloneVar($data)->withRefHandles(false)); diff --git a/src/Symfony/Component/VarDumper/Tests/Test/VarDumpTestTraitRequire54.php b/src/Symfony/Component/VarDumper/Tests/Test/VarDumpTestTraitRequire54.php new file mode 100644 index 0000000000..240cc926aa --- /dev/null +++ b/src/Symfony/Component/VarDumper/Tests/Test/VarDumpTestTraitRequire54.php @@ -0,0 +1,41 @@ + + * + * 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 .= << array:4 [ + 0 => "a" + 1 => "b" + 2 => "c" + 3 => "d" + ]\n +EODUMP; + } + $expected .= "]\n"; + + $this->assertDumpEquals($expected, $data); + } +} diff --git a/src/Symfony/Component/VarDumper/Tests/Test/VarDumpTestTraitTest.php b/src/Symfony/Component/VarDumper/Tests/Test/VarDumpTestTraitTest.php new file mode 100644 index 0000000000..21ef14d9ff --- /dev/null +++ b/src/Symfony/Component/VarDumper/Tests/Test/VarDumpTestTraitTest.php @@ -0,0 +1,16 @@ + + * + * 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'; +} +