@@ -1,6 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class Issue0005Test extends SwaggerGen_TestCase { |
|
3 | +class Issue0005Test extends SwaggerGen_TestCase |
|
4 | +{ |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * @covers \SwaggerGen\Swagger\Swagger::__construct |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -spl_autoload_register(function ($classname) { |
|
3 | +spl_autoload_register(function($classname) { |
|
4 | 4 | $file = dirname(__DIR__) . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $classname) . '.php'; |
5 | 5 | if (is_file($file)) { |
6 | 6 | require_once $file; |
@@ -240,7 +240,7 @@ |
||
240 | 240 | * @covers \SwaggerGen\Swagger\Operation::handleCommand |
241 | 241 | */ |
242 | 242 | public function testHandleCommand_OperationId_UniqueInSwagger() |
243 | - { |
|
243 | + { |
|
244 | 244 | // First occurance |
245 | 245 | $path = $this->parent->handleCommand('endpoint', 'foo'); |
246 | 246 | $this->assertInstanceOf('\SwaggerGen\Swagger\Path', $path); |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | 'responses' => array( |
724 | 724 | 200 => array( |
725 | 725 | 'description' => 'OK', |
726 | - 'schema' => Array( |
|
726 | + 'schema' => array( |
|
727 | 727 | 'type' => 'integer', |
728 | 728 | 'format' => 'int32', |
729 | 729 | ), |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | 'responses' => array( |
748 | 748 | 200 => array( |
749 | 749 | 'description' => 'Stuff is returned', |
750 | - 'schema' => Array( |
|
750 | + 'schema' => array( |
|
751 | 751 | 'type' => 'integer', |
752 | 752 | 'format' => 'int32', |
753 | 753 | ), |
@@ -337,23 +337,23 @@ |
||
337 | 337 | . ',"tags":[{"name":"Test"}]}', json_encode($array, JSON_NUMERIC_CHECK)); |
338 | 338 | } |
339 | 339 | |
340 | - public function testObjectPropertiesReadOnly() |
|
341 | - { |
|
342 | - $object = new \SwaggerGen\SwaggerGen(); |
|
343 | - $array = $object->getSwagger(array(' |
|
340 | + public function testObjectPropertiesReadOnly() |
|
341 | + { |
|
342 | + $object = new \SwaggerGen\SwaggerGen(); |
|
343 | + $array = $object->getSwagger(array(' |
|
344 | 344 | api Test |
345 | 345 | endpoint /test |
346 | 346 | method GET something |
347 | 347 | response 200 object(a!:array(A),b:array(B)) |
348 | 348 | ')); |
349 | 349 | |
350 | - $this->assertSame('{"swagger":2,"info":{"title":"undefined","version":0}' |
|
351 | - . ',"paths":{"\/test":{"get":{"tags":["Test"],"summary":"something"' |
|
352 | - . ',"responses":{"200":{"description":"OK","schema":{"type":"object","required":["b"]' |
|
353 | - . ',"properties":{"a":{"type":"array","items":{"$ref":"#\/definitions\/A"}}' |
|
354 | - . ',"b":{"type":"array","items":{"$ref":"#\/definitions\/B"}}}}}}}}}' |
|
355 | - . ',"tags":[{"name":"Test"}]}', json_encode($array, JSON_NUMERIC_CHECK)); |
|
356 | - } |
|
350 | + $this->assertSame('{"swagger":2,"info":{"title":"undefined","version":0}' |
|
351 | + . ',"paths":{"\/test":{"get":{"tags":["Test"],"summary":"something"' |
|
352 | + . ',"responses":{"200":{"description":"OK","schema":{"type":"object","required":["b"]' |
|
353 | + . ',"properties":{"a":{"type":"array","items":{"$ref":"#\/definitions\/A"}}' |
|
354 | + . ',"b":{"type":"array","items":{"$ref":"#\/definitions\/B"}}}}}}}}}' |
|
355 | + . ',"tags":[{"name":"Test"}]}', json_encode($array, JSON_NUMERIC_CHECK)); |
|
356 | + } |
|
357 | 357 | |
358 | 358 | public function testDeepObjectProperties() |
359 | 359 | { |
@@ -81,20 +81,20 @@ |
||
81 | 81 | ), $object->toArray()); |
82 | 82 | } |
83 | 83 | |
84 | - /** |
|
85 | - * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct |
|
86 | - */ |
|
87 | - public function testConstructReadOnly() |
|
88 | - { |
|
89 | - $object = new SwaggerGen\Swagger\Type\Property($this->parent, 'string', 'Some words here', true); |
|
90 | - $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object); |
|
91 | - |
|
92 | - $this->assertSame(array( |
|
93 | - 'type' => 'string', |
|
94 | - 'description' => 'Some words here', |
|
95 | - 'readOnly' => true |
|
96 | - ), $object->toArray()); |
|
97 | - } |
|
84 | + /** |
|
85 | + * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct |
|
86 | + */ |
|
87 | + public function testConstructReadOnly() |
|
88 | + { |
|
89 | + $object = new SwaggerGen\Swagger\Type\Property($this->parent, 'string', 'Some words here', true); |
|
90 | + $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object); |
|
91 | + |
|
92 | + $this->assertSame(array( |
|
93 | + 'type' => 'string', |
|
94 | + 'description' => 'Some words here', |
|
95 | + 'readOnly' => true |
|
96 | + ), $object->toArray()); |
|
97 | + } |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct |
@@ -29,7 +29,8 @@ |
||
29 | 29 | * |
30 | 30 | * @rest\api Users Get some useful information on users |
31 | 31 | */ |
32 | -class Example { |
|
32 | +class Example |
|
33 | +{ |
|
33 | 34 | |
34 | 35 | private $data = array(); |
35 | 36 |
@@ -30,10 +30,11 @@ |
||
30 | 30 | ); |
31 | 31 | } |
32 | 32 | |
33 | - public function provideAllCases() { |
|
33 | + public function provideAllCases() |
|
34 | + { |
|
34 | 35 | $cases = array(); |
35 | 36 | |
36 | - foreach (glob(__DIR__ . '/*', GLOB_ONLYDIR) as $dir) { |
|
37 | + foreach (glob(__DIR__ . '/*', GLOB_ONLYDIR) as $dir) { |
|
37 | 38 | $path = realpath($dir); |
38 | 39 | $json = $this->normalizeJson(file_get_contents($path . '/expected.json')); |
39 | 40 |