1<?php 2 3namespace dokuwiki\test\Parsing; 4 5/** 6 * Locale files are core assets authored in DokuWiki syntax. They must render 7 * as 'dw' even when the wiki is configured for Markdown — otherwise bracket 8 * and apostrophe pairs would survive into the output as literal text. 9 */ 10class LocaleXhtmlTest extends \DokuWikiTest 11{ 12 /** Stage a locale file under the (temporary) DOKU_CONF lang dir. */ 13 private function stageLocale(string $id, string $content): void 14 { 15 global $conf; 16 $dir = DOKU_CONF . 'lang/' . $conf['lang']; 17 io_makeFileDir($dir . '/' . $id . '.txt'); 18 io_saveFile($dir . '/' . $id . '.txt', $content); 19 } 20 21 public function testLocaleRendersAsDwUnderMarkdownConfig() 22 { 23 global $conf; 24 $conf['syntax'] = 'md'; 25 26 $this->stageLocale('synctest', "A [[wiki:syntax]] link."); 27 28 $html = p_locale_xhtml('synctest'); 29 30 // Rendered as DW: the bracket pair becomes a real link, not literal text 31 $this->assertStringContainsString('<a ', $html, 'locale link must render as a link under md config'); 32 $this->assertStringNotContainsString('[[wiki:syntax]]', $html, 'bracket pair must not survive as literal text'); 33 } 34} 35