@@ -44,7 +44,12 @@ public function testReadYamlWithAnchors()
4444 $ openApiFile = __DIR__ . '/spec/data/traits-mixins.yaml ' ;
4545 $ openapi = \cebe \openapi \Reader::readFromYamlFile ($ openApiFile );
4646
47- $ this ->assertApiContent ($ openapi );
47+ $ this ->assertApiContent ($ openapi , [
48+ '[/paths/~1foo/put/responses/200] Invalid field: "schema" ' ,
49+ '[/paths/~1foo/put/responses/404] Invalid field: "schema" ' ,
50+ '[/paths/~1foo/put/responses/428] Invalid field: "schema" ' ,
51+ '[/paths/~1foo/put/responses/default] Invalid field: "schema" '
52+ ]);
4853
4954 $ putOperation = $ openapi ->paths ['/foo ' ]->put ;
5055 $ this ->assertEquals ('create foo ' , $ putOperation ->description );
@@ -77,16 +82,11 @@ public function testReadYamlWithAnchors()
7782 $ this ->assertEquals ('uuid of the resource ' , $ foo ->properties ['uuid ' ]->description );
7883 }
7984
80- private function assertApiContent (\cebe \openapi \spec \OpenApi $ openapi )
85+ private function assertApiContent (\cebe \openapi \spec \OpenApi $ openapi, $ expected = [] )
8186 {
8287 $ result = $ openapi ->validate ();
83- $ this ->assertEquals ([
84- '[/paths/~1foo/put/responses/200] Invalid field: "schema" ' ,
85- '[/paths/~1foo/put/responses/404] Invalid field: "schema" ' ,
86- '[/paths/~1foo/put/responses/428] Invalid field: "schema" ' ,
87- '[/paths/~1foo/put/responses/default] Invalid field: "schema" '
88- ], $ openapi ->getErrors ());
89- $ this ->assertFalse ($ result );
88+ $ this ->assertEquals ($ expected , $ openapi ->getErrors ());
89+ $ expected ? $ this ->assertFalse ($ result ) : $ this ->assertTrue ($ result );
9090
9191
9292 $ this ->assertEquals ("3.0.0 " , $ openapi ->openapi );
0 commit comments