function test_parse() { try { Layout::parse('{"version":"0.8.1"}'); $this->fail(); } catch (Exception\IncompatibleLayout $e) { // OK } try { Layout::parse('{"version":"1.0.0"}'); $this->fail(); } catch (Exception\IncompatibleLayout $e) { // OK } $layout = Layout::parse('{"version":"0.8.2", "svg":"<svg></svg>"}'); $this->assertInstanceOf('Thinreports\\Layout', $layout); }
function test_parse() { try { Layout::parse('{"version":"0.8.1"}'); $this->fail(); } catch (Exception\IncompatibleLayout $e) { // OK } try { Layout::parse('{"version":"0.9.0"}'); $this->fail(); } catch (Exception\IncompatibleLayout $e) { // OK } $parsed_format = Layout::parse('{"version":"0.8.2", "svg":"<svg></svg>"}'); $this->assertSame(array('version' => '0.8.2', 'svg' => '<svg></svg>'), $parsed_format['format']); $this->assertSame(array(), $parsed_format['item_formats']); }