44
55namespace PhpKafka \PhpAvroSchemaGenerator \Tests \Unit \Parser ;
66
7+ use PhpKafka \PhpAvroSchemaGenerator \Parser \ClassParser ;
78use PhpKafka \PhpAvroSchemaGenerator \Parser \ClassPropertyParser ;
89use PhpKafka \PhpAvroSchemaGenerator \Parser \DocCommentParserInterface ;
910use PhpKafka \PhpAvroSchemaGenerator \PhpClass \PhpClassPropertyInterface ;
1011use PhpParser \Comment \Doc ;
1112use PhpParser \Node \Identifier ;
1213use PhpParser \Node \NullableType ;
14+ use PhpParser \Node \Stmt \Class_ ;
1315use PhpParser \Node \Stmt \Property ;
1416use PhpParser \Node \Stmt \PropertyProperty ;
1517use PhpParser \Node \UnionType ;
@@ -20,6 +22,7 @@ class ClassPropertyParserTest extends TestCase
2022{
2123 public function testParseProperty (): void
2224 {
25+ $ classParser = $ this ->getMockBuilder (ClassParser::class)->disableOriginalConstructor ()->getMock ();
2326 $ doc = $ this ->getMockBuilder (Doc::class)->disableOriginalConstructor ()->getMock ();
2427 $ varId = $ this ->getMockBuilder (VarLikeIdentifier::class)->disableOriginalConstructor ()->getMock ();
2528 $ varId ->name = 'bla ' ;
@@ -48,19 +51,9 @@ public function testParseProperty(): void
4851 $ property4 ->props = [$ propertyProperty ];
4952 $ cpp = new ClassPropertyParser ($ docParser );
5053
51- self ::assertInstanceOf (PhpClassPropertyInterface::class, $ cpp ->parseProperty ($ property1 ));
52- self ::assertInstanceOf (PhpClassPropertyInterface::class, $ cpp ->parseProperty ($ property2 ));
53- self ::assertInstanceOf (PhpClassPropertyInterface::class, $ cpp ->parseProperty ($ property3 ));
54- self ::assertInstanceOf (PhpClassPropertyInterface::class, $ cpp ->parseProperty ($ property4 ));
54+ self ::assertInstanceOf (PhpClassPropertyInterface::class, $ cpp ->parseProperty ($ property1, $ classParser ));
55+ self ::assertInstanceOf (PhpClassPropertyInterface::class, $ cpp ->parseProperty ($ property2, $ classParser ));
56+ self ::assertInstanceOf (PhpClassPropertyInterface::class, $ cpp ->parseProperty ($ property3, $ classParser ));
57+ self ::assertInstanceOf (PhpClassPropertyInterface::class, $ cpp ->parseProperty ($ property4, $ classParser ));
5558 }
56-
57- public function testParsePropertyExceptionOnNonProperty (): void
58- {
59- self ::expectException (\RuntimeException::class);
60- self ::expectExceptionMessage ('Property must be of type: PhpParser\Node\Stmt\Property ' );
61- $ docParser = $ this ->getMockForAbstractClass (DocCommentParserInterface::class);
62- $ cpp = new ClassPropertyParser ($ docParser );
63-
64- $ cpp ->parseProperty (1 );
65- }
66- }
59+ }
0 commit comments