Skip to content

Commit dd5717a

Browse files
Tweaked tests for assoc array tests
1 parent 9d8a082 commit dd5717a

File tree

5 files changed

+52
-12
lines changed

5 files changed

+52
-12
lines changed

tests/Constraints/AdditionalPropertiesTest.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
namespace JsonSchema\Tests\Constraints;
1111

12-
use JsonSchema\Validator;
13-
1412
class AdditionalPropertiesTest extends BaseTestCase
1513
{
1614
public function getInvalidTests()
@@ -52,8 +50,7 @@ public function getInvalidTests()
5250
"prop":{"type":"string"}
5351
},
5452
"additionalProperties": false
55-
}',
56-
Validator::CHECK_MODE_TYPE_CAST
53+
}'
5754
),
5855
array(
5956
'{
@@ -79,8 +76,7 @@ public function getInvalidTests()
7976
"prop":{"type":"string"}
8077
},
8178
"additionalProperties": {"type":"string"}
82-
}',
83-
Validator::CHECK_MODE_TYPE_CAST
79+
}'
8480
),
8581
array(
8682
'{
@@ -132,8 +128,7 @@ public function getValidTests()
132128
"properties":{
133129
"prop":{"type":"string"}
134130
}
135-
}',
136-
Validator::CHECK_MODE_TYPE_CAST
131+
}'
137132
),
138133
array(
139134
'{

tests/Constraints/OfPropertiesTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
*/
88
namespace JsonSchema\Tests\Constraints;
99

10-
use JsonSchema\Validator;
11-
1210
/**
1311
* Class OfPropertiesTest
1412
*/
@@ -71,7 +69,7 @@ public function getInvalidTests()
7169
},
7270
"required": ["prop1"]
7371
}',
74-
Validator::CHECK_MODE_NORMAL,
72+
null,
7573
array(
7674
array(
7775
"property" => "prop2",

tests/Constraints/RequiredPropertyTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace JsonSchema\Tests\Constraints;
1111

12+
use JsonSchema\Constraints\Constraint;
1213
use JsonSchema\Constraints\UndefinedConstraint;
1314

1415
class RequiredPropertyTest extends BaseTestCase
@@ -229,7 +230,8 @@ public function getInvalidTests()
229230
"properties": {
230231
"array":{"type":"array", "required": true}
231232
}
232-
}'
233+
}',
234+
Constraint::CHECK_MODE_NORMAL
233235
),
234236
array(
235237
'{

tests/Drafts/Draft3Test.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
namespace JsonSchema\Tests\Drafts;
11+
use JsonSchema\Constraints\Constraint;
1112

1213
/**
1314
* @package JsonSchema\Tests\Drafts
@@ -25,6 +26,28 @@ protected function getFilePaths()
2526
);
2627
}
2728

29+
public function getInvalidForAssocTests()
30+
{
31+
$tests = parent::getInvalidForAssocTests();
32+
unset(
33+
$tests['type.json / object type matches objects / an array is not an object'],
34+
$tests['type.json / array type matches arrays / an object is not an array']
35+
);
36+
37+
return $tests;
38+
}
39+
40+
public function getValidForAssocTests()
41+
{
42+
$tests = parent::getValidForAssocTests();
43+
unset(
44+
$tests['type.json / object type matches objects / an array is not an object'],
45+
$tests['type.json / array type matches arrays / an object is not an array']
46+
);
47+
48+
return $tests;
49+
}
50+
2851
/**
2952
* {@inheritdoc}
3053
*/

tests/Drafts/Draft4Test.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,28 @@ protected function getFilePaths()
2525
);
2626
}
2727

28+
public function getInvalidForAssocTests()
29+
{
30+
$tests = parent::getInvalidForAssocTests();
31+
unset(
32+
$tests['type.json / object type matches objects / an array is not an object'],
33+
$tests['type.json / array type matches arrays / an object is not an array']
34+
);
35+
36+
return $tests;
37+
}
38+
39+
public function getValidForAssocTests()
40+
{
41+
$tests = parent::getValidForAssocTests();
42+
unset(
43+
$tests['type.json / object type matches objects / an array is not an object'],
44+
$tests['type.json / array type matches arrays / an object is not an array']
45+
);
46+
47+
return $tests;
48+
}
49+
2850
/**
2951
* {@inheritdoc}
3052
*/

0 commit comments

Comments
 (0)