UndefinedTest.php 773 B

12345678910111213141516171819202122232425262728293031
  1. <?php declare(strict_types=1);
  2. /**
  3. * @license Apache 2.0
  4. */
  5. namespace OpenApiTests;
  6. use OpenApi\Annotations\AbstractAnnotation;
  7. use const OpenApi\UNDEFINED;
  8. use function get_class_vars;
  9. class UndefinedTest extends OpenApiTestCase
  10. {
  11. /**
  12. * @dataProvider allAnnotations
  13. */
  14. public function testDefaultPropertiesAreUndefined($annotation)
  15. {
  16. $properties = get_class_vars($annotation);
  17. $skip = AbstractAnnotation::$_blacklist;
  18. foreach ($properties as $property => $value) {
  19. if (in_array($property, $skip)) {
  20. continue;
  21. }
  22. if ($value === null) {
  23. $this->fail("Property ".basename($annotation).'->'.$property.' should be UNDEFINED');
  24. }
  25. }
  26. }
  27. }