atoum / json-schema-extension

The atoum json-schema-extension allows you to validate JSON against schemas.
Other
8 stars 4 forks source link

Tests not passed #6

Closed fferriere closed 8 years ago

fferriere commented 8 years ago

On JSON asserter's test, failure appear :

Failure (2 tests, 10/10 methods, 0 void method, 0 skipped method, 0 uncompleted method, 0 failure, 0 error, 3 exceptions)!                                                                                                                      
> There are 3 exceptions:
=> mageekguy\atoum\jsonSchema\tests\units\asserters\json::testSetWithJsonGrammar():
==> An exception has been thrown in file json-schema-extension/tests/units/classes/asserters/json.php on line 46:
==> exception 'mageekguy\atoum\asserter\exception' with message 'string(43) '{
==> "M*4M" : [
==> " jnd       " ]
                   ,    "
                         a! "   : null } ' is not a valid JSON string' in json-schema-extension/vendor/atoum/atoum/classes/asserter.php:142
==> Stack trace:
==> #0 json-schema-extension/classes/asserters/json.php(42): mageekguy\atoum\asserter->fail('string(43) '{\n"...')
==> #1 json-schema-extension/tests/units/classes/asserters/json.php(46): mageekguy\atoum\jsonSchema\asserters\json->setWith('{\n"M*4M"\xC2\xA0: [\n"...')
==> #2 [internal function]: mageekguy\atoum\jsonSchema\tests\units\asserters\json->testSetWithJsonGrammar('{\n"M*4M"\xC2\xA0: [\n"...')
==> #3 json-schema-extension/vendor/atoum/atoum/classes/test.php(1329): ReflectionMethod->invokeArgs(Object(mageekguy\atoum\jsonSchema\tests\units\asserters\json), Array)
==> #4 -(1): mageekguy\atoum\test->runTestMethod('testSetWithJson...')
==> #5 {main}
=> mageekguy\atoum\jsonSchema\tests\units\asserters\json::testValidatesJsonArrayGrammar():
==> An exception has been thrown in file json-schema-extension/tests/units/classes/asserters/json.php on line 95:
"=> exception 'mageekguy\atoum\asserter\exception' with message 'string(45) '[ {
 f3j " : [      true ,
true ]ue ,
      } ] ' is not a valid JSON string' in json-schema-extension/vendor/atoum/atoum/classes/asserter.php:142
==> Stack trace:
==> #0 json-schema-extension/classes/asserters/json.php(42): mageekguy\atoum\asserter->fail('string(45) '[ {...')
==> #1 json-schema-extension/tests/units/classes/asserters/json.php(95): mageekguy\atoum\jsonSchema\asserters\json->setWith('[ {\r"\ff3j " : [...')
==> #2 [internal function]: mageekguy\atoum\jsonSchema\tests\units\asserters\json->testValidatesJsonArrayGrammar('[ {\r"\ff3j " : [...')
==> #3 json-schema-extension/vendor/atoum/atoum/classes/test.php(1329): ReflectionMethod->invokeArgs(Object(mageekguy\atoum\jsonSchema\tests\units\asserters\json), Array)
==> #4 -(1): mageekguy\atoum\test->runTestMethod('testValidatesJs...')
==> #5 {main}
=> mageekguy\atoum\jsonSchema\tests\units\asserters\json::testNotValidatesJsonArrayGrammar():
==> An exception has been thrown in file json-schema-extension/tests/units/classes/asserters/json.php on line 111:
:LG$ "ception 'mageekguy\atoum\asserter\exception' with message 'string(55) '{ "
 true , "
         A
: true , "  j " : true  }
==> ' is not a valid JSON string' in json-schema-extension/vendor/atoum/atoum/classes/asserter.php:142
==> Stack trace:
==> #0 json-schema-extension/classes/asserters/json.php(42): mageekguy\atoum\asserter->fail('string(55) '{ "...')
==> #1 json-schema-extension/tests/units/classes/asserters/json.php(111): mageekguy\atoum\jsonSchema\asserters\json->setWith('{ "\r|LG$ "\r:\ftr...')
==> #2 [internal function]: mageekguy\atoum\jsonSchema\tests\units\asserters\json->testNotValidatesJsonArrayGrammar('{ "\r|LG$ "\r:\ftr...')
==> #3 json-schema-extension/vendor/atoum/atoum/classes/test.php(1329): ReflectionMethod->invokeArgs(Object(mageekguy\atoum\jsonSchema\tests\units\asserters\json), Array)
==> #4 -(1): mageekguy\atoum\test->runTestMethod('testNotValidate...')
==> #5 {main}

The problem seems to be with extra characters like "\f" or with UTF-8 characters like " U+00A0 | 194 160 | NO-BREAK SPACE".

agallou commented 8 years ago

fixed in #13