ItemsTest.php 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * @license Apache 2.0
  4. */
  5. namespace SwaggerTests;
  6. class ItemsTest extends SwaggerTestCase
  7. {
  8. public function testItemTypeArray()
  9. {
  10. $annotations = $this->parseComment('@SWG\Items(type="array")');
  11. $this->assertSwaggerLogEntryStartsWith('@SWG\Items() is required when @SWG\Items() has type "array" in ');
  12. $annotations[0]->validate();
  13. }
  14. public function testSchemaTypeArray()
  15. {
  16. $annotations = $this->parseComment('@SWG\Schema(type="array")');
  17. $this->assertSwaggerLogEntryStartsWith('@SWG\Items() is required when @SWG\Schema() has type "array" in ');
  18. $annotations[0]->validate();
  19. }
  20. public function testTypeObject()
  21. {
  22. $notAllowedInQuery = $this->parseComment('@SWG\Parameter(name="param",in="query",type="array",@SWG\Items(type="object"))');
  23. $this->assertSwaggerLogEntryStartsWith('@SWG\Items()->type="object" not allowed inside a @SWG\Parameter() must be "string", "number", "integer", "boolean", "array" in ');
  24. $notAllowedInQuery[0]->validate();
  25. }
  26. }