Esempio n. 1
0
 protected function getDocument($schema, $data, $noException = false)
 {
     $schema = $this->getSchemaObject($schema);
     $data = $data ?: null;
     if ($data) {
         $data = json_decode($data);
         if (null === $data) {
             throw new \InvalidArgumentException('Test not run, $data not valid json');
         }
     }
     $document = new \JohnStevenson\JsonWorks\Document();
     $document->loadData($data, $noException);
     $document->loadSchema($schema, $noException);
     return $document;
 }
Esempio n. 2
0
 public function testNumberNoExceptionFail()
 {
     $document = new \JohnStevenson\JsonWorks\Document();
     $data = 0;
     $result = $document->loadSchema($data, true);
     $expected = 'Invalid input';
     $this->assertFalse($result);
     $this->assertContains($expected, $document->lastError);
 }