Browse files

Add test cases for optional enums

Added test cases where required is set as true and false,
with the attribute omitted.
  • Loading branch information...
1 parent 78cbf74 commit 5c4cf3dbc3a2807228564366ec1468cb58ddd92d @JoakimLofgren JoakimLofgren committed Aug 10, 2012
Showing with 38 additions and 0 deletions.
  1. +38 −0 tests/JsonSchema/Tests/Constraints/EnumTest.php
View
38 tests/JsonSchema/Tests/Constraints/EnumTest.php
@@ -25,6 +25,20 @@ public function getInvalidTests()
},
"additionalProperties":false
}'
+ ),
+ array(
+ '{}',
+ '{
+ "type":"object",
+ "properties":{
+ "value":{
+ "type":"string",
+ "enum":["Abacate","Manga","Pitanga"],
+ "required":true
+ }
+ },
+ "additionalProperties":false
+ }'
)
);
}
@@ -43,6 +57,30 @@ public function getValidTests()
},
"additionalProperties":false
}'
+ ),
+ array(
+ '{}',
+ '{
+ "type":"object",
+ "properties":{
+ "value":{"type":"string","enum":["Abacate","Manga","Pitanga"]}
+ },
+ "additionalProperties":false
+ }'
+ ),
+ array(
+ '{}',
+ '{
+ "type":"object",
+ "properties":{
+ "value":{
+ "type":"string",
+ "enum":["Abacate","Manga","Pitanga"],
+ "required":false
+ }
+ },
+ "additionalProperties":false
+ }'
)
);
}

0 comments on commit 5c4cf3d

Please sign in to comment.