mirror of
https://github.com/justinrainbow/json-schema.git
synced 2025-05-01 20:09:46 +02:00
description for failing tests. Flatten directory structure Use "test.json / suite description / test case description" notation in data provider to allow a readable test output Skip Draft3Test / Draft4Test tests which are not passing Add some comment to skipped tests
163 lines
4.6 KiB
PHP
163 lines
4.6 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the JsonSchema package.
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace JsonSchema\Tests\Constraints;
|
|
|
|
class DisallowTest extends BaseTestCase
|
|
{
|
|
public function getInvalidTests()
|
|
{
|
|
return array(
|
|
array(
|
|
'{
|
|
"value":"The xpto is weird"
|
|
}',
|
|
'{
|
|
"type":"object",
|
|
"properties":{
|
|
"value":{
|
|
"type":"any",
|
|
"disallow":{"type":"string","pattern":"xpto"}
|
|
}
|
|
}
|
|
}'
|
|
),
|
|
array(
|
|
'{
|
|
"value":null
|
|
}',
|
|
'{
|
|
"type":"object",
|
|
"properties":{
|
|
"value":{
|
|
"type":"any",
|
|
"disallow":{"type":"null"}
|
|
}
|
|
}
|
|
}'
|
|
),
|
|
array(
|
|
'{"value": 1}',
|
|
'{
|
|
"type": "object",
|
|
"properties": {
|
|
"value": {"type": "any", "disallow": "integer"}
|
|
}
|
|
}'
|
|
),
|
|
array(
|
|
'{"value": true}',
|
|
'{
|
|
"type": "object",
|
|
"properties": {
|
|
"value": {"type": "any", "disallow": ["integer", "boolean"]}
|
|
}
|
|
}'
|
|
),
|
|
array(
|
|
'{"value": "foo"}',
|
|
'{
|
|
"type": "object",
|
|
"properties": {
|
|
"value": {
|
|
"type": "any",
|
|
"disallow":
|
|
["string", {
|
|
"type": "object",
|
|
"properties": {
|
|
"foo": {"type": "string"}
|
|
}
|
|
}]
|
|
}
|
|
}
|
|
}'
|
|
),
|
|
array(
|
|
'{"value": {"foo": "bar"}}',
|
|
'{
|
|
"type": "object",
|
|
"properties": {
|
|
"value": {
|
|
"type": "any",
|
|
"disallow":
|
|
["string", {
|
|
"type": "object",
|
|
"properties": {
|
|
"foo": {"type": "string"}
|
|
}
|
|
}]
|
|
}
|
|
}
|
|
}'
|
|
)
|
|
);
|
|
}
|
|
|
|
public function getValidTests()
|
|
{
|
|
return array(
|
|
array(
|
|
'{
|
|
"value":"The xpto is weird"
|
|
}',
|
|
'{
|
|
"type":"object",
|
|
"properties":{
|
|
"value":{
|
|
"type":"any",
|
|
"disallow":{"type":"string","pattern":"^xpto"}
|
|
}
|
|
}
|
|
}'
|
|
),
|
|
array(
|
|
'{
|
|
"value":1
|
|
}',
|
|
'{
|
|
"type":"object",
|
|
"properties":{
|
|
"value":{
|
|
"type":"any",
|
|
"disallow":{"type":"null"}
|
|
}
|
|
}
|
|
}'
|
|
),
|
|
array(
|
|
'{"value": {"foo": 1}}',
|
|
'{
|
|
"type": "object",
|
|
"properties": {
|
|
"value": {
|
|
"type": "any",
|
|
"disallow":
|
|
["string", {
|
|
"type": "object",
|
|
"properties": {
|
|
"foo": {"type": "string"}
|
|
}
|
|
}]
|
|
}
|
|
}
|
|
}'
|
|
),
|
|
array(
|
|
'{"value": true}',
|
|
'{
|
|
"type": "object",
|
|
"properties": {
|
|
"value": {"type": "any", "disallow": "string"}
|
|
}
|
|
}'
|
|
)
|
|
);
|
|
}
|
|
}
|