ClhNTC4uLgo=
OUT; $input = << XML... IN; $instructions = p_get_instructions($input); $xhtml = p_render('xhtml', $instructions, $info); $this->assertEquals($expected, $xhtml); } public function test_syntax_dmn() { $info = array(); $expected = <<
ClhNTC4uLgo=
OUT; $input = << XML... IN; $instructions = p_get_instructions($input); $xhtml = p_render('xhtml', $instructions, $info); $this->assertEquals($expected, $xhtml); } /** * Test that type defaults to bpmn when not specified */ public function test_syntax_default_type() { $info = array(); $input = << XML... IN; $instructions = p_get_instructions($input); $xhtml = p_render('xhtml', $instructions, $info); $this->assertStringContainsString('bpmn_js_data', $xhtml); $this->assertStringContainsString('bpmn_js_canvas', $xhtml); $this->assertStringContainsString('bpmn_js_container', $xhtml); } /** * Test empty content between tags */ public function test_syntax_empty_content() { $info = array(); $input = << IN; $instructions = p_get_instructions($input); $xhtml = p_render('xhtml', $instructions, $info); // Should still produce the structure, with base64 of whitespace/empty $this->assertStringContainsString('plugin-bpmnio', $xhtml); $this->assertStringContainsString('bpmn_js_data', $xhtml); } /** * Test that multiline XML content is properly base64-encoded */ public function test_syntax_multiline_content() { $info = array(); $input = << IN; $instructions = p_get_instructions($input); $xhtml = p_render('xhtml', $instructions, $info); $this->assertStringContainsString('bpmn_js_data', $xhtml); // Verify the data section contains valid base64 preg_match('/
\s*(.*?)\s*<\/div>/s', $xhtml, $matches); $this->assertNotEmpty($matches[1]); $decoded = base64_decode(trim($matches[1]), true); $this->assertNotFalse($decoded, 'Content should be valid base64'); $this->assertStringContainsString('definitions', $decoded); } /** * Test that the plugin produces section edit markers for inline content */ public function test_syntax_section_edit_bpmn() { $info = array(); $input = << Content IN; $instructions = p_get_instructions($input); $xhtml = p_render('xhtml', $instructions, $info); $this->assertStringContainsString('sectionedit', $xhtml); $this->assertStringContainsString('plugin_bpmnio_bpmn', $xhtml); } /** * Test that the plugin produces section edit markers for DMN inline content */ public function test_syntax_section_edit_dmn() { $info = array(); $input = << Content IN; $instructions = p_get_instructions($input); $xhtml = p_render('xhtml', $instructions, $info); $this->assertStringContainsString('sectionedit', $xhtml); $this->assertStringContainsString('plugin_bpmnio_dmn', $xhtml); } /** * Test that unrecognized text outside is not affected */ public function test_syntax_no_interference() { $info = array(); $input = << XML... Goodbye World IN; $instructions = p_get_instructions($input); $xhtml = p_render('xhtml', $instructions, $info); $this->assertStringContainsString('Hello World', $xhtml); $this->assertStringContainsString('Goodbye World', $xhtml); $this->assertStringContainsString('plugin-bpmnio', $xhtml); } public function test_syntax_zoom_attribute() { $info = array(); $input = << XML... IN; $instructions = p_get_instructions($input); $xhtml = p_render('xhtml', $instructions, $info); $this->assertStringContainsString('data-zoom="0.5"', $xhtml); } public function test_syntax_ignores_invalid_zoom_attribute() { $info = array(); $input = << XML... IN; $instructions = p_get_instructions($input); $xhtml = p_render('xhtml', $instructions, $info); $this->assertStringNotContainsString('data-zoom=', $xhtml); } public function test_syntax_builds_link_payload_for_named_elements() { $info = array(); io_mkdir_p(dirname(wikiFN('docs:start'))); io_saveFile(wikiFN('docs:start'), 'Read docs'); $input = << IN; $instructions = p_get_instructions($input); $xhtml = p_render('xhtml', $instructions, $info); preg_match('/
\s*(.*?)\s*<\/div>/s', $xhtml, $xmlMatch); $this->assertNotEmpty($xmlMatch[1]); $decodedXml = base64_decode(trim($xmlMatch[1]), true); $this->assertNotFalse($decodedXml); $this->assertStringContainsString('name="Read docs"', $decodedXml); $this->assertStringNotContainsString('[[', $decodedXml); preg_match('/