@@ -141,8 +141,11 @@ public function testPathItemReference()
141141 $ openapi = Reader::readFromYamlFile ($ file , \cebe \openapi \spec \OpenApi::class, false );
142142
143143 $ result = $ openapi ->validate ();
144- $ this ->assertEquals ([], $ openapi ->getErrors (), print_r ($ openapi ->getErrors (), true ));
145- $ this ->assertTrue ($ result );
144+ $ this ->assertEquals ([
145+ 'Invalid field: "X-EXTENSION" ' ,
146+ 'Invalid field: "xyz-extension" '
147+ ], $ openapi ->getErrors (), print_r ($ openapi ->getErrors (), true ));
148+ $ this ->assertFalse ($ result );
146149
147150 $ this ->assertInstanceOf (Paths::class, $ openapi ->paths );
148151 $ this ->assertInstanceOf (PathItem::class, $ fooPath = $ openapi ->paths ['/foo ' ]);
@@ -173,12 +176,16 @@ public function testPathItemReference()
173176 $ this ->assertInstanceOf (Response::class, $ path200 );
174177 $ this ->assertEquals ('A bar ' , $ path200 ->description );
175178
179+ unset($ openapi );
176180 /** @var $openapi OpenApi */
177181 $ openapi = Reader::readFromYamlFile ($ file , \cebe \openapi \spec \OpenApi::class, true );
178182
179183 $ result = $ openapi ->validate ();
180- $ this ->assertEquals ([], $ openapi ->getErrors (), print_r ($ openapi ->getErrors (), true ));
181- $ this ->assertTrue ($ result );
184+ $ this ->assertEquals ([
185+ 'Invalid field: "X-EXTENSION" ' ,
186+ 'Invalid field: "xyz-extension" '
187+ ], $ openapi ->getErrors ());
188+ $ this ->assertFalse ($ result );
182189
183190 $ this ->assertInstanceOf (Paths::class, $ openapi ->paths );
184191 $ this ->assertInstanceOf (PathItem::class, $ fooPath = $ openapi ->paths ['/foo ' ]);
0 commit comments