mirror of
https://github.com/justinrainbow/json-schema.git
synced 2025-05-02 04:18:09 +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
96 lines
2.5 KiB
PHP
96 lines
2.5 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 DivisibleByTest extends BaseTestCase
|
|
{
|
|
public function getInvalidTests()
|
|
{
|
|
return array(
|
|
array(
|
|
'{"value": 5.6333}',
|
|
'{
|
|
"type":"object",
|
|
"properties":{
|
|
"value":{"type":"number","divisibleBy":3}
|
|
}
|
|
}'
|
|
),
|
|
array(
|
|
'{"value": 35}',
|
|
'{
|
|
"type": "object",
|
|
"properties": {
|
|
"value": {"type": "integer", "divisibleBy": 1.5}
|
|
}
|
|
}'
|
|
),
|
|
array(
|
|
'{"value": 0.00751}',
|
|
'{
|
|
"type": "object",
|
|
"properties": {
|
|
"value": {"type": "number", "divisibleBy": 0.0001}
|
|
}
|
|
}'
|
|
),
|
|
array(
|
|
'{"value": 7}',
|
|
'{
|
|
"type": "object",
|
|
"properties": {
|
|
"value": {"type": "integer", "divisibleBy": 2}
|
|
}
|
|
}'
|
|
)
|
|
);
|
|
}
|
|
|
|
public function getValidTests()
|
|
{
|
|
return array(
|
|
array(
|
|
'{"value": 6}',
|
|
'{
|
|
"type":"object",
|
|
"properties":{
|
|
"value":{"type":"number","divisibleBy":3}
|
|
}
|
|
}'
|
|
),
|
|
array(
|
|
'{"value": 4.5}',
|
|
'{
|
|
"type": "object",
|
|
"properties": {
|
|
"value": {"type": "number", "divisibleBy": 1.5}
|
|
}
|
|
}'
|
|
),
|
|
array(
|
|
'{"value": 0.0075}',
|
|
'{
|
|
"properties": {
|
|
"value": {"type": "number", "divisibleBy": 0.0001}
|
|
}
|
|
}'
|
|
),
|
|
array(
|
|
'{"value": 1}',
|
|
'{
|
|
"properties": {
|
|
"value": {"type": "number", "divisibleBy": 0.02}
|
|
}
|
|
}'
|
|
)
|
|
);
|
|
}
|
|
}
|