Source of file JsonDataObjectSchemaTest.php
Size: 1,931 Bytes - Last Modified: 2021-12-24T06:51:36+00:00
/var/www/docs.ssmods.com/process/src/tests/DataObjectSchema/JsonDataObjectSchemaTest.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 | <?php namespace Heystack\Core\DataObjectSchema; use Doctrine\Common\Cache\ArrayCache; use org\bovigo\vfs\vfsStream; /** * Class JsonDataObjectSchemaTest * @package Heystack\Core\DataObjectSchema */ class JsonDataObjectSchemaTest extends \PHPUnit_Framework_TestCase { /** * @var */ protected $schema; /** * */ protected function setUp() { vfsStream::setup('root', null, [ 'schema.json' => <<<JSON { "id": "Test", "flat":{ "Test":"Text" }, "parent":null, "children":{ "Tests":"+Test" } } JSON , 'invalid.json' => <<<JSON sss JSON ]); $this->schema = new JsonDataObjectSchema( vfsStream::url('root/schema.json'), new ArrayCache() ); } /** * @covers \Heystack\Core\DataObjectSchema\JsonDataObjectSchema::parseFile */ public function testSchemaConstruct() { $this->assertTrue( is_object($this->schema) ); } /** * @expectedException \Heystack\Core\Exception\ConfigurationException * @covers \Heystack\Core\DataObjectSchema\JsonDataObjectSchema::parseFile */ public function testNoConstruct() { new JsonDataObjectSchema( vfsStream::url('root/fake.json'), new ArrayCache() ); } /** * @covers \Heystack\Core\DataObjectSchema\JsonDataObjectSchema::parseFile * @covers \Heystack\Core\DataObjectSchema\JsonDataObjectSchema::getLastJsonError * @expectedException \Heystack\Core\Exception\ConfigurationException * @expectedExceptionMessage Json file 'vfs://root/invalid.json' is invalid: Syntax error, malformed JSON */ public function testExceptionThrownOnInvalidJson() { new JsonDataObjectSchema( vfsStream::url('root/invalid.json'), new ArrayCache() ); } } |