Version 1
[yaffs-website] / vendor / symfony / http-kernel / Tests / DataCollector / Util / ValueExporterTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\HttpKernel\Tests\DataCollector\Util;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
16
17 class ValueExporterTest extends TestCase
18 {
19     /**
20      * @var ValueExporter
21      */
22     private $valueExporter;
23
24     protected function setUp()
25     {
26         $this->valueExporter = new ValueExporter();
27     }
28
29     public function testDateTime()
30     {
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));
33     }
34
35     /**
36      * @requires PHP 5.5
37      */
38     public function testDateTimeImmutable()
39     {
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));
42     }
43
44     public function testIncompleteClass()
45     {
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));
50     }
51 }