1<?php 2 3namespace dokuwiki\plugin\bureaucracy\test; 4 5/** 6 * @group plugin_bureaucracy 7 * @group plugins 8 */ 9class bureaucracy_actions_template_test extends BureaucracyTest { 10 11 public function dataProvider() 12 { 13 return [ 14 [ 15 'This is <noreplace>test</noreplace>.', 16 '', 17 '', 18 'This is test.', 19 [], 20 '<noreplace></noreplace> not removed.', 21 ], 22 [ 23 '%Y-%m-%d <noreplace>%Y-%m-%d</noreplace>.', 24 '', 25 '', 26 date('Y-m-d') . ' %Y-%m-%d.', 27 [], 28 'Date replaced inside <noreplace></noreplace>.', 29 ], 30 [ 31 '@@test@@ <noreplace>@@test@@</noreplace>.', 32 'textbox test', 33 'something', 34 'something @@test@@.', 35 [], 36 'Field value replaced inside <noreplace></noreplace>.', 37 ], 38 [ 39 '<noreplace>@ID@ @USER@ @MAIL@</noreplace>', 40 '', 41 '', 42 '@ID@ @USER@ @MAIL@', 43 [], 44 'DokuWiki replacement paterns for templates replaced inside <noreplace></noreplace>.', 45 ], 46 [ 47 '<noreplace>@FORMPAGE_ID@ @FORMPAGE_NS@ @FORMPAGE_CURNS@</noreplace>', 48 '', 49 '', 50 '@FORMPAGE_ID@ @FORMPAGE_NS@ @FORMPAGE_CURNS@', 51 [], 52 '@FORMPAGE_*@ replacement paterns replaced inside <noreplace></noreplace>.', 53 ], 54 [ 55 '<noreplace><noinclude>TEST</noinclude></noreplace>', 56 '', 57 '', 58 '<noinclude>TEST</noinclude>', 59 [], 60 'noinclude tag inside <replaced inside <noreplace></noreplace>.', 61 ], 62 [ 63 '<noreplace>@NSBASE@</noreplace>', 64 '', 65 '', 66 '@NSBASE@', 67 [], 68 '"@NSBASE@" replaced inside <noreplace></noreplace>.', 69 ], 70 [ 71 '<noreplace>%%</noreplace>', 72 '', 73 '', 74 '%%', 75 [], 76 '"%%" replaced inside <noreplace></noreplace>.', 77 ] 78 ]; 79 } 80 81 /** 82 * @dataProvider dataProvider 83 * 84 * @param string $templateSyntax 85 * @param string $formSyntax 86 * @param string $postedValue 87 * @param string $expectedWikiText 88 * @param string $msg 89 * 90 */ 91 public function test_noreplace_tag( 92 $templateSyntax, 93 $formSyntax, 94 $postedValue, 95 $expectedWikiText, 96 $expectedValidationErrors, 97 $msg 98 ) { 99 $actualValidationErrors = []; 100 101 $actualWikiText = parent::send_form_action_template( 102 $formSyntax, 103 $templateSyntax, 104 $actualValidationErrors, 105 $postedValue 106 ); 107 108 if (empty($expectedValidationErrors)) { 109 $this->assertEquals($expectedWikiText, $actualWikiText, $msg); 110 } 111 $this->assertEquals($expectedValidationErrors, $actualValidationErrors, $msg); 112 } 113} 114