|
16 | 16 | use Symfony\Component\VarDumper\Caster\ClassStub; |
17 | 17 | use Symfony\Component\VarDumper\Caster\LinkStub; |
18 | 18 | use Symfony\Component\VarDumper\Caster\ScalarStub; |
| 19 | +use Symfony\Component\VarDumper\Caster\VirtualStub; |
19 | 20 | use Symfony\Component\VarDumper\Cloner\VarCloner; |
20 | 21 | use Symfony\Component\VarDumper\Dumper\HtmlDumper; |
21 | 22 | use Symfony\Component\VarDumper\Test\VarDumperTestTrait; |
22 | 23 | use Symfony\Component\VarDumper\Tests\Fixtures\FooInterface; |
| 24 | +use Symfony\Component\VarDumper\Tests\Fixtures\VirtualProperty; |
23 | 25 |
|
24 | 26 | class StubCasterTest extends TestCase |
25 | 27 | { |
@@ -101,6 +103,40 @@ public function testEmptyStub() |
101 | 103 | $this->assertDumpMatchesFormat($expectedDump, $args); |
102 | 104 | } |
103 | 105 |
|
| 106 | + /** |
| 107 | + * @requires PHP 8.4 |
| 108 | + */ |
| 109 | + public function testVirtualPropertyStub() |
| 110 | + { |
| 111 | + $class = new \ReflectionClass(VirtualProperty::class); |
| 112 | + $args = [new VirtualStub($class->getProperty('fullName'))]; |
| 113 | + |
| 114 | + $expectedDump = <<<'EODUMP' |
| 115 | +array:1 [ |
| 116 | + 0 => ~ string |
| 117 | +] |
| 118 | +EODUMP; |
| 119 | + |
| 120 | + $this->assertDumpMatchesFormat($expectedDump, $args); |
| 121 | + } |
| 122 | + |
| 123 | + /** |
| 124 | + * @requires PHP 8.4 |
| 125 | + */ |
| 126 | + public function testVirtualPropertyWithoutTypeStub() |
| 127 | + { |
| 128 | + $class = new \ReflectionClass(VirtualProperty::class); |
| 129 | + $args = [new VirtualStub($class->getProperty('noType'))]; |
| 130 | + |
| 131 | + $expectedDump = <<<'EODUMP' |
| 132 | +array:1 [ |
| 133 | + 0 => ~ |
| 134 | +] |
| 135 | +EODUMP; |
| 136 | + |
| 137 | + $this->assertDumpMatchesFormat($expectedDump, $args); |
| 138 | + } |
| 139 | + |
104 | 140 | public function testLinkStub() |
105 | 141 | { |
106 | 142 | $var = [new LinkStub(__CLASS__, 0, __FILE__)]; |
@@ -217,7 +253,7 @@ public function testClassStubWithAnonymousClass() |
217 | 253 |
|
218 | 254 | $expectedDump = <<<'EODUMP' |
219 | 255 | <foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp data-depth=1 class=sf-dump-expanded> |
220 | | - <span class=sf-dump-index>0</span> => "<a href="%sStubCasterTest.php:209" rel="noopener noreferrer"><span class=sf-dump-str title="19 characters">Exception@anonymous</span></a>" |
| 256 | + <span class=sf-dump-index>0</span> => "<a href="%sStubCasterTest.php:245" rel="noopener noreferrer"><span class=sf-dump-str title="19 characters">Exception@anonymous</span></a>" |
221 | 257 | </samp>] |
222 | 258 | </bar> |
223 | 259 | EODUMP; |
|
0 commit comments