@@ -61,20 +61,36 @@ public function testDump_Price(): void
6161 $ this ->assertSame ([], $ data ->getProperties ()[0 ]->getType ()->getTypes ()[0 ]->getNamespace (), 'namespace. ' );
6262 $ this ->assertSame (true , $ data ->getProperties ()[0 ]->getAccessModifier ()->isPrivate (), 'property price Modifiers. ' );
6363 }
64- // public function testDump_php8_Price(): void {
65- // $options = new Options([]);
66- // $directory = sprintf('%s/php8', $this->fixtureDir);
67- // $filename = sprintf('%s/php8/product/Price.php', $this->fixtureDir);
68- // $classes = PhpReader::parseFile($directory, $filename, $options);
64+ public function testDump_php8_Price (): void
65+ {
66+ $ options = new Options ([]);
67+ $ directory = sprintf ('%s/php8 ' , $ this ->fixtureDir );
68+ $ filename = sprintf ('%s/php8/product/Price.php ' , $ this ->fixtureDir );
69+ $ classes = PhpReader::parseFile ($ directory , $ filename , $ options );
70+
71+ $ data = $ classes [0 ]->getInfo ();
72+ $ this ->assertSame ('Price ' , $ data ->getClassType ()->getName (), 'class type name. ' );
73+ $ this ->assertSame (['hoge ' , 'fuga ' , 'product ' ], $ data ->getClassType ()->getNamespace (), 'namespace name. ' );
74+ $ this ->assertSame ('price8 ' , $ data ->getProperties ()[0 ]->getName (), 'property price. ' );
75+ $ this ->assertSame ('int|float ' , $ data ->getProperties ()[0 ]->getType ()->getName (), 'property price type. php8 union type. ' );
76+ $ this ->assertSame ([], $ data ->getProperties ()[0 ]->getType ()->getTypes ()[0 ]->getNamespace (), 'namespace. ' );
77+ $ this ->assertSame (true , $ data ->getProperties ()[0 ]->getAccessModifier ()->isPrivate (), 'property price Modifiers. ' );
78+ }
79+ public function testDump_php8_constructer_properties (): void
80+ {
81+ $ options = new Options ([]);
82+ $ directory = sprintf ('%s/php8 ' , $ this ->fixtureDir );
83+ $ filename = sprintf ('%s/php8/product/Price.php ' , $ this ->fixtureDir );
84+ $ classes = PhpReader::parseFile ($ directory , $ filename , $ options );
6985
70- // $data = $classes[0]->getInfo();
71- // $this->assertSame('Price', $data->getClassType()->name , 'class type name.');
72- // $this->assertSame(['hoge', 'fuga', 'product'], $data->getClassType()->getNamespace(), 'namespace name.');
73- // $this->assertSame('price ', $data->getProperties()[0 ]->name , 'property price .');
74- // $this->assertSame('int|float ', $data->getProperties()[0 ]->type ->getName(), 'property price type. php8 union type.');
75- // $this->assertSame(['hoge', 'fuga', 'product' ], $data->getProperties()[0 ]->type ->getNamespace(), 'namespace.');
76- // $this->assertSame(true, $data->getProperties()[0 ]->accessModifier->private , 'property price Modifiers.');
77- // }
86+ $ data = $ classes [0 ]->getInfo ();
87+ $ this ->assertSame ('Price ' , $ data ->getClassType ()->getName () , 'class type name. ' );
88+ $ this ->assertSame (['hoge ' , 'fuga ' , 'product ' ], $ data ->getClassType ()->getNamespace (), 'namespace name. ' );
89+ $ this ->assertSame ('field1 ' , $ data ->getProperties ()[1 ]->getName () , 'property field1 . ' );
90+ $ this ->assertSame ('int ' , $ data ->getProperties ()[1 ]->getType () ->getName (), 'property field1 type. php8 union type. ' );
91+ $ this ->assertSame ([], $ data ->getProperties ()[1 ]->getType ()-> getTypes ()[ 0 ] ->getNamespace (), 'namespace. ' );
92+ $ this ->assertSame (true , $ data ->getProperties ()[1 ]->getAccessModifier ()-> isPrivate () , 'property field1 Modifiers. ' );
93+ }
7894
7995 public function testDump_with_namespace (): void
8096 {
0 commit comments