1*32ff69b6SAndreas Gohr<?php 2*32ff69b6SAndreas Gohr 3*32ff69b6SAndreas Gohrnamespace dokuwiki\plugin\dw2pdf\test; 4*32ff69b6SAndreas Gohr 5*32ff69b6SAndreas Gohruse DokuWikiTest; 6*32ff69b6SAndreas Gohr 7*32ff69b6SAndreas Gohr/** 8*32ff69b6SAndreas Gohr * Export link tests for the dw2pdf plugin 9*32ff69b6SAndreas Gohr * 10*32ff69b6SAndreas Gohr * @group plugin_dw2pdf 11*32ff69b6SAndreas Gohr * @group plugins 12*32ff69b6SAndreas Gohr */ 13*32ff69b6SAndreas Gohrclass SyntaxExportLinkTest extends DokuWikiTest 14*32ff69b6SAndreas Gohr{ 15*32ff69b6SAndreas Gohr 16*32ff69b6SAndreas Gohr protected $pluginsEnabled = array('dw2pdf'); 17*32ff69b6SAndreas Gohr 18*32ff69b6SAndreas Gohr function testParser() 19*32ff69b6SAndreas Gohr { 20*32ff69b6SAndreas Gohr global $ID; 21*32ff69b6SAndreas Gohr $ID = 'foo:bar:start'; 22*32ff69b6SAndreas Gohr $parser_response = p_get_instructions('~~PDFNS>.:|Foo~~'); 23*32ff69b6SAndreas Gohr $expected_parser_response = array( 24*32ff69b6SAndreas Gohr 'plugin', 25*32ff69b6SAndreas Gohr array( 26*32ff69b6SAndreas Gohr 'dw2pdf_exportlink', 27*32ff69b6SAndreas Gohr array( 28*32ff69b6SAndreas Gohr 'link' => '?do=export_pdfns&book_ns=foo:bar&book_title=Foo', 29*32ff69b6SAndreas Gohr 'title' => 'Export namespace "foo:bar:" to file Foo.pdf', 30*32ff69b6SAndreas Gohr 5, 31*32ff69b6SAndreas Gohr 1, 32*32ff69b6SAndreas Gohr ), 33*32ff69b6SAndreas Gohr 5, 34*32ff69b6SAndreas Gohr '~~PDFNS>.:|Foo~~', 35*32ff69b6SAndreas Gohr ), 36*32ff69b6SAndreas Gohr 1, 37*32ff69b6SAndreas Gohr ); 38*32ff69b6SAndreas Gohr $this->assertEquals($expected_parser_response, $parser_response[2]); 39*32ff69b6SAndreas Gohr $renderer_response = p_render('xhtml', $parser_response, $info); 40*32ff69b6SAndreas Gohr $expected_renderer_response = 'doku.php?id=foo:bar:start&do=export_pdfns&book_ns=foo:bar&book_title=Foo" class="wikilink2" title="foo:bar:start" rel="nofollow" data-wiki-id="foo:bar:start">Export namespace "foo:bar:" to file Foo.pdf</a>'; 41*32ff69b6SAndreas Gohr $trimmed_renderer_response = substr($renderer_response, strpos($renderer_response, 'doku.php'), -5); 42*32ff69b6SAndreas Gohr $trimmed_renderer_response = trim($trimmed_renderer_response); 43*32ff69b6SAndreas Gohr $this->assertEquals($expected_renderer_response, $trimmed_renderer_response); 44*32ff69b6SAndreas Gohr } 45*32ff69b6SAndreas Gohr} 46*32ff69b6SAndreas Gohr 47