VarDumperTestTraitTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\VarDumper\Tests\Test;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
  13. class VarDumperTestTraitTest extends TestCase
  14. {
  15. use VarDumperTestTrait;
  16. public function testItComparesLargeData()
  17. {
  18. $howMany = 700;
  19. $data = array_fill_keys(range(0, $howMany), ['a', 'b', 'c', 'd']);
  20. $expected = sprintf("array:%d [\n", $howMany + 1);
  21. for ($i = 0; $i <= $howMany; ++$i) {
  22. $expected .= <<<EODUMP
  23. $i => array:4 [
  24. 0 => "a"
  25. 1 => "b"
  26. 2 => "c"
  27. 3 => "d"
  28. ]\n
  29. EODUMP;
  30. }
  31. $expected .= "]\n";
  32. $this->assertDumpEquals($expected, $data);
  33. }
  34. public function testAllowsNonScalarExpectation()
  35. {
  36. $this->assertDumpEquals(new \ArrayObject(['bim' => 'bam']), new \ArrayObject(['bim' => 'bam']));
  37. }
  38. }