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 6
6
use Swaggest \JsonSchema \JsonSchema ;
7
7
use Swaggest \JsonSchema \ProcessingOptions ;
8
8
use Swaggest \JsonSchema \RemoteRef \Preloaded ;
9
+ use Swaggest \JsonSchema \SwaggerSchema \SwaggerSchema ;
9
10
10
11
class SwaggerTest extends \PHPUnit_Framework_TestCase
11
12
{
12
13
public function testReadSwaggerSchema ()
13
14
{
14
15
$ schemaData = json_decode (file_get_contents (__DIR__ . '/../../../../spec/swagger-schema.json ' ));
15
16
16
-
17
17
$ refProvider = new Preloaded ();
18
18
$ refProvider ->setSchemaData ('http://swagger.io/v2/schema.json ' , $ schemaData );
19
19
20
20
$ options = new ProcessingOptions ();
21
21
$ options ->setRemoteRefProvider ($ refProvider );
22
22
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
-
29
23
$ 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
+ );
31
30
}
32
31
33
32
}
You can’t perform that action at this time.
0 commit comments