ExamplesTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * @license Apache 2.0
  4. */
  5. namespace SwaggerTests;
  6. class ExamplesTest extends SwaggerTestCase
  7. {
  8. /**
  9. * Test the processed Examples against json files in ExamplesOutput.
  10. *
  11. * @dataProvider getExamples
  12. * @param string $example Example path
  13. * @param string $output Expected output (path to a json file)
  14. */
  15. public function testExample($example, $output)
  16. {
  17. $swagger = \Swagger\scan(__DIR__ . '/../Examples/' . $example);
  18. $this->assertSwaggerEqualsFile(__DIR__ . '/ExamplesOutput/' . $output, $swagger);
  19. }
  20. /**
  21. * dataProvider for testExample
  22. * @return array
  23. */
  24. public function getExamples()
  25. {
  26. return [
  27. ['petstore.swagger.io', 'petstore.swagger.io.json'],
  28. ['swagger-spec/petstore', 'petstore.json'],
  29. ['swagger-spec/petstore-simple', 'petstore-simple.json'],
  30. ['swagger-spec/petstore-with-external-docs', 'petstore-with-external-docs.json'],
  31. ['using-refs', 'using-refs.json'],
  32. ['dynamic-reference', 'dynamic-reference.json'],
  33. ];
  34. }
  35. }