No Description

ValueExporterTest.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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\HttpKernel\Tests\DataCollector\Util;
  11. use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
  12. /**
  13. * @group legacy
  14. */
  15. class ValueExporterTest extends \PHPUnit_Framework_TestCase
  16. {
  17. /**
  18. * @var ValueExporter
  19. */
  20. private $valueExporter;
  21. protected function setUp()
  22. {
  23. $this->valueExporter = new ValueExporter();
  24. }
  25. public function testDateTime()
  26. {
  27. $dateTime = new \DateTime('2014-06-10 07:35:40', new \DateTimeZone('UTC'));
  28. $this->assertSame('Object(DateTime) - 2014-06-10T07:35:40+0000', $this->valueExporter->exportValue($dateTime));
  29. }
  30. public function testDateTimeImmutable()
  31. {
  32. $dateTime = new \DateTimeImmutable('2014-06-10 07:35:40', new \DateTimeZone('UTC'));
  33. $this->assertSame('Object(DateTimeImmutable) - 2014-06-10T07:35:40+0000', $this->valueExporter->exportValue($dateTime));
  34. }
  35. public function testIncompleteClass()
  36. {
  37. $foo = new \__PHP_Incomplete_Class();
  38. $array = new \ArrayObject($foo);
  39. $array['__PHP_Incomplete_Class_Name'] = 'AppBundle/Foo';
  40. $this->assertSame('__PHP_Incomplete_Class(AppBundle/Foo)', $this->valueExporter->exportValue($foo));
  41. }
  42. }