File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
tests/src/PHPUnit/Swagger Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 66use Swaggest \JsonSchema \JsonSchema ;
77use Swaggest \JsonSchema \ProcessingOptions ;
88use Swaggest \JsonSchema \RemoteRef \Preloaded ;
9+ use Swaggest \JsonSchema \SwaggerSchema \SwaggerSchema ;
910
1011class SwaggerTest extends \PHPUnit_Framework_TestCase
1112{
1213 public function testReadSwaggerSchema ()
1314 {
1415 $ schemaData = json_decode (file_get_contents (__DIR__ . '/../../../../spec/swagger-schema.json ' ));
1516
16-
1717 $ refProvider = new Preloaded ();
1818 $ refProvider ->setSchemaData ('http://swagger.io/v2/schema.json ' , $ schemaData );
1919
2020 $ options = new ProcessingOptions ();
2121 $ options ->setRemoteRefProvider ($ refProvider );
2222
23- $ schema = JsonSchema::importToSchema ($ schemaData , $ options );
24- $ ts = $ schema ->definitions ['header ' ]->properties ['maximum ' ];
25- $ max = $ schema ->definitions ['maximum ' ];
26- $ this ->assertSame ('number ' , $ ts ->type );
27-
28-
2923 $ swaggerData = json_decode (file_get_contents (__DIR__ . '/../../../../spec/petstore-swagger.json ' ));
30- $ petstore = $ schema ->import ($ swaggerData );
24+ $ petStore = SwaggerSchema::create ()->import ($ swaggerData );
25+
26+ $ this ->assertSame (
27+ '/pet:/pet/findByStatus:/pet/findByTags:/pet/{petId}:/pet/{petId}/uploadImage:/store/inventory:/store/order:/store/order/{orderId}:/user:/user/createWithArray:/user/createWithList:/user/login:/user/logout:/user/{username} ' ,
28+ implode (': ' , array_keys ($ petStore ->paths ->toArray ()))
29+ );
3130 }
3231
3332}
You can’t perform that action at this time.
0 commit comments