4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\HttpKernel\Tests\DataCollector\Util;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
17 class ValueExporterTest extends TestCase
22 private $valueExporter;
24 protected function setUp()
26 $this->valueExporter = new ValueExporter();
29 public function testDateTime()
31 $dateTime = new \DateTime('2014-06-10 07:35:40', new \DateTimeZone('UTC'));
32 $this->assertSame('Object(DateTime) - 2014-06-10T07:35:40+00:00', $this->valueExporter->exportValue($dateTime));
38 public function testDateTimeImmutable()
40 $dateTime = new \DateTimeImmutable('2014-06-10 07:35:40', new \DateTimeZone('UTC'));
41 $this->assertSame('Object(DateTimeImmutable) - 2014-06-10T07:35:40+00:00', $this->valueExporter->exportValue($dateTime));
44 public function testIncompleteClass()
46 $foo = new \__PHP_Incomplete_Class();
47 $array = new \ArrayObject($foo);
48 $array['__PHP_Incomplete_Class_Name'] = 'AppBundle/Foo';
49 $this->assertSame('__PHP_Incomplete_Class(AppBundle/Foo)', $this->valueExporter->exportValue($foo));