function testShowData() { $handler = new Doku_Handler(); $xhtml = new Doku_Renderer_xhtml(); $plugin = new syntax_plugin_data_entry(); $result = $plugin->handle($this->exampleEntry, 0, 10, $handler); $plugin->_showData($result, $xhtml); $doc = phpQuery::newDocument($xhtml->doc); $this->assertEquals(1, pq('div.inline.dataplugin_entry.projects', $doc)->length); $this->assertEquals(1, pq('dl dt.type')->length); $this->assertEquals(1, pq('dl dd.type')->length); $this->assertEquals(1, pq('dl dt.volume')->length); $this->assertEquals(1, pq('dl dd.volume')->length); $this->assertEquals(1, pq('dl dt.employee')->length); $this->assertEquals(1, pq('dl dd.employee')->length); $this->assertEquals(1, pq('dl dt.customer')->length); $this->assertEquals(1, pq('dl dd.customer')->length); $this->assertEquals(1, pq('dl dt.deadline')->length); $this->assertEquals(1, pq('dl dd.deadline')->length); $this->assertEquals(1, pq('dl dt.server')->length); $this->assertEquals(1, pq('dl dd.server')->length); $this->assertEquals(1, pq('dl dt.website')->length); $this->assertEquals(1, pq('dl dd.website')->length); $this->assertEquals(1, pq('dl dt.task')->length); $this->assertEquals(1, pq('dl dd.task')->length); $this->assertEquals(1, pq('dl dt.tests')->length); $this->assertEquals(1, pq('dl dd.tests')->length); }
function testComments() { $entry = "---- dataentry projects ----\n" . "volume : 1 Mrd # how much do they pay?\n" . "server : http://www.microsoft.com # Comment\n" . "Website_url : http://www.microsoft.com\\#test # Comment\n" . "Site_url : https://www.microsoft.com/page\\#test\n" . "tests_ : \\#5 done\n" . "----\n"; $plugin = new syntax_plugin_data_entry(); $handler = new Doku_Handler(); $result = $plugin->handle($entry, 0, 10, $handler); $this->assertEquals(10, $result['pos'], 'Position has changed'); $this->assertEquals('projects', $result['classes'], 'wrong class name detected'); $data = array('volume' => '1 Mrd', 'server' => 'http://www.microsoft.com', 'website' => 'http://www.microsoft.com#test', 'site' => 'https://www.microsoft.com/page#test', 'tests' => '#5 done', '----' => ''); $this->assertEquals($data, $result['data'], 'Data array corrupted'); }