1<?php 2 3namespace dokuwiki\plugin\imagemap\test; 4 5/** 6 * General tests for the imagemap plugin 7 * 8 * @group plugin_imagemap 9 * @group plugins 10 */ 11class MapsTest extends \DokuWikiTest 12{ 13 14 protected $pluginsEnabled = ['imagemapping']; 15 16 public function test_simple_map() 17 { 18 $parser_response = p_get_instructions('{{map>:512px-catstalkprey.jpg|Bild1422436366012}} * [[foo|bar@ 354,185,437,251]] {{<map}}'); 19 $expected_response = [ 20 0 => [ 21 0 => 'document_start', 22 1 => [], 23 2 => 0, 24 ], 25 1 => [ 26 0 => 'plugin', 27 1 => [ 28 0 => 'imagemapping', 29 1 => [ 30 0 => DOKU_LEXER_ENTER, 31 1 => 'internalmedia', 32 2 => ':512px-catstalkprey.jpg', 33 3 => 'Bild1422436366012', 34 4 => 'bild1422436366012', 35 5 => '', 36 6 => '', 37 7 => '', 38 8 => 'cache', 39 ], 40 41 2 => DOKU_LEXER_ENTER, 42 3 => '{{map>:512px-catstalkprey.jpg|Bild1422436366012}}', 43 ], 44 45 2 => 1, 46 ], 47 48 2 => [ 49 0 => 'plugin', 50 1 => [ 51 0 => 'imagemapping', 52 1 => [ 53 0 => DOKU_LEXER_MATCHED, 54 1 => 'area', 55 2 => 'rect', 56 3 => '354,185,437,251', 57 4 => 'internallink', 58 5 => 'bar', 59 6 => 'foo', 60 7 => '', 61 ], 62 63 2 => DOKU_LEXER_MATCHED, 64 ], 65 66 2 => 1, 67 ], 68 69 3 => 70 [ 71 0 => 'plugin', 72 1 => 73 [ 74 0 => 'imagemapping', 75 1 => 76 [ 77 0 => DOKU_LEXER_MATCHED, 78 1 => 'divstart', 79 ], 80 81 2 => DOKU_LEXER_MATCHED, 82 ], 83 84 2 => 1, 85 ], 86 87 4 => 88 [ 89 0 => 'cdata', 90 1 => 91 [ 92 0 => "\n", 93 94 ], 95 96 2 => 50, 97 ], 98 99 5 => 100 [ 101 0 => 'plugin', 102 1 => 103 [ 104 0 => 'imagemapping', 105 1 => 106 [ 107 0 => DOKU_LEXER_UNMATCHED, 108 1 => ' * ', 109 ], 110 111 2 => DOKU_LEXER_UNMATCHED, 112 3 => ' * ', 113 ], 114 115 2 => 50, 116 ], 117 118 6 => 119 [ 120 0 => 'internallink', 121 1 => 122 [ 123 0 => 'foo', 124 1 => 'bar', 125 ], 126 127 2 => 55, 128 ], 129 130 7 => 131 [ 132 0 => 'plugin', 133 1 => 134 [ 135 0 => 'imagemapping', 136 1 => 137 [ 138 0 => DOKU_LEXER_UNMATCHED, 139 1 => ' ', 140 ], 141 142 2 => DOKU_LEXER_UNMATCHED, 143 3 => ' ', 144 ], 145 146 2 => 83, 147 ], 148 149 8 => 150 [ 151 0 => 'plugin', 152 1 => 153 [ 154 0 => 'imagemapping', 155 1 => 156 [ 157 0 => DOKU_LEXER_MATCHED, 158 1 => 'divend', 159 ], 160 161 2 => DOKU_LEXER_MATCHED, 162 ], 163 164 2 => 83, 165 ], 166 167 9 => 168 [ 169 0 => 'plugin', 170 1 => 171 [ 172 0 => 'imagemapping', 173 1 => 174 [ 175 0 => DOKU_LEXER_EXIT, 176 ], 177 178 2 => DOKU_LEXER_EXIT, 179 3 => '{{<map}}', 180 ], 181 182 2 => 84, 183 ], 184 185 10 => 186 [ 187 0 => 'document_end', 188 1 => 189 [ 190 ], 191 192 2 => 84, 193 ], 194 195 ]; 196 $this->assertEquals($expected_response, $parser_response); 197 } 198} 199