@@ -67,15 +67,22 @@ public function guessSuccessDataProvider(): iterable
6767 /**
6868 * @dataProvider guessErrorDataProvider
6969 */
70- public function testGuessError (string $ docType , string $ reflectorClass , string $ match ): void
70+ public function testGuessError (string $ docType , string $ reflectorClass , string $ match, bool $ canParsingFailed = false ): void
7171 {
7272 $ docBlockGuesser = new DocBlockTypeGuesser (new ClassesTypesMap ());
7373 try {
7474 $ docBlockGuesser ->guessType (new ReflectionClass (__CLASS__ ), $ this ->getMockedReflector ($ docType , $ reflectorClass ));
7575 $ this ->fail (sprintf ('The @var "%s" should resolve to GraphQL type "%s" ' , $ docType , $ match ));
7676 } catch (Exception $ e ) {
7777 $ this ->assertInstanceOf (TypeGuessingException::class, $ e );
78- $ this ->assertStringContainsString ($ match , $ e ->getMessage ());
78+ if ($ canParsingFailed ) {
79+ $ this ->assertThat ($ e ->getMessage (), $ this ->logicalOr (
80+ $ this ->equalTo ('Doc Block parsing failed with ' ),
81+ $ this ->equalTo ($ e ->getMessage ())
82+ ));
83+ } else {
84+ $ this ->assertStringContainsString ($ match , $ e ->getMessage ());
85+ }
7986 }
8087 }
8188
@@ -88,8 +95,8 @@ public function guessErrorDataProvider(): iterable
8895 yield ['object ' , $ reflectorClass , 'Tag @ ' .$ tag .' found, but type "object" is too generic ' ];
8996 yield ['mixed[] ' , $ reflectorClass , 'Tag @ ' .$ tag .' found, but the array values cannot be mixed type ' ];
9097 yield ['array<mixed> ' , $ reflectorClass , 'Tag @ ' .$ tag .' found, but the array values cannot be mixed type ' ];
91- yield ['' , $ reflectorClass , 'No @ ' .$ tag .' tag found in doc block or tag has no type ' ];
92- yield ['[] ' , $ reflectorClass , 'No @ ' .$ tag .' tag found in doc block or tag has no type ' ];
98+ yield ['' , $ reflectorClass , 'No @ ' .$ tag .' tag found in doc block or tag has no type ' , true ]; // phpDocumentor/ReflectionDocBlock
99+ yield ['[] ' , $ reflectorClass , 'No @ ' .$ tag .' tag found in doc block or tag has no type ' , true ]; // phpDocumentor/ReflectionDocBlock
93100 }
94101 }
95102
0 commit comments