Ticket #31432: 31432.patch
File 31432.patch, 14.1 KB (added by , 10 years ago) |
---|
-
tests/phpunit/tests/dependencies/styles.php
220 220 <![endif]--> 221 221 222 222 CSS; 223 $expected = str_replace( "\r\n", "\n", $expected ); 224 223 225 wp_enqueue_style( 'handle', 'http://example.com', array(), 1 ); 224 226 wp_style_add_data( 'handle', 'conditional', 'IE' ); 225 227 wp_add_inline_style( 'handle', 'a { color: blue; }' ); -
tests/phpunit/tests/functions/getArchives.php
45 45 <li><a href='$link4'>Post title 5</a></li> 46 46 <li><a href='$link5'>Post title 4</a></li> 47 47 EOF; 48 $expected['limit'] = str_replace( "\r\n", "\n", $expected['limit'] ); 49 48 50 $this->assertEquals( $expected['limit'], trim( wp_get_archives( array( 'echo' => false, 'type' => 'postbypost', 'limit' => 5 ) ) ) ); 49 51 } 50 52 … … 80 82 <li><a href='{$oct_url}'>October 2012</a></li> 81 83 <li><a href='{$this->month_url}'>$date_full</a></li> 82 84 EOF; 85 $expected['order_asc'] = str_replace( "\r\n", "\n", $expected['order_asc'] ); 86 83 87 $this->assertEquals( $expected['order_asc'], trim( wp_get_archives( array( 'echo' => false, 'order' => 'ASC' ) ) ) ); 84 88 85 89 $expected['order_desc'] = <<<EOF … … 86 90 <li><a href='{$this->month_url}'>$date_full</a></li> 87 91 <li><a href='{$oct_url}'>October 2012</a></li> 88 92 EOF; 93 $expected['order_desc'] = str_replace( "\r\n", "\n", $expected['order_desc'] ); 94 89 95 $this->assertEquals( $expected['order_desc'], trim( wp_get_archives( array( 'echo' => false, 'order' => 'DESC' ) ) ) ); 90 96 } 91 97 } -
tests/phpunit/tests/general/paginateLinks.php
33 33 <a class='page-numbers' href='$page50'>50</a> 34 34 <a class="next page-numbers" href="$page2">Next »</a> 35 35 EXPECTED; 36 $expected = str_replace( "\r\n", "\n", $expected ); 36 37 37 38 $links = paginate_links( array( 'total' => 50 ) ); 38 39 $this->assertEquals( $expected, $links ); … … 51 52 <a class='page-numbers' href='$page50'>50</a> 52 53 <a class="next page-numbers" href="$page2">Next »</a> 53 54 EXPECTED; 55 $expected = str_replace( "\r\n", "\n", $expected ); 54 56 55 57 $links = paginate_links( array( 'total' => 50, 'format' => 'page/%#%/' ) ); 56 58 $this->assertEquals( $expected, $links ); … … 70 72 <span class="page-numbers dots">…</span> 71 73 <a class='page-numbers' href='$page50'>50</a> 72 74 EXPECTED; 75 $expected = str_replace( "\r\n", "\n", $expected ); 73 76 74 77 $links = paginate_links( array( 'total' => 50, 'prev_next' => false, 'current' => 2 ) ); 75 78 $this->assertEquals( $expected, $links ); … … 91 94 <a class='page-numbers' href='$page50'>50</a> 92 95 <a class="next page-numbers" href="$page3">Next »</a> 93 96 EXPECTED; 97 $expected = str_replace( "\r\n", "\n", $expected ); 94 98 95 99 $links = paginate_links( array( 'total' => 50, 'prev_next' => true, 'current' => 2 ) ); 96 100 $this->assertEquals( $expected, $links ); -
tests/phpunit/tests/pomo/po.php
3 3 class Tests_POMO_PO extends WP_UnitTestCase { 4 4 function setUp() { 5 5 require_once ABSPATH . '/wp-includes/pomo/po.php'; 6 6 7 // not so random wordpress.pot string -- multiple lines 7 8 $this->mail = "Your new WordPress blog has been successfully set up at: 8 9 … … 18 19 --The WordPress Team 19 20 http://wordpress.org/ 20 21 "; 22 $this->mail = str_replace( "\r\n", "\n", $this->mail ); 23 21 24 $this->po_mail = '"" 22 25 "Your new WordPress blog has been successfully set up at:\n" 23 26 "\n" … … 32 35 "\n" 33 36 "--The WordPress Team\n" 34 37 "http://wordpress.org/\n"'; 38 $this->po_mail = str_replace( "\r\n", "\n", $this->po_mail ); 39 35 40 $this->a90 = str_repeat("a", 90); 36 41 $this->po_a90 = "\"$this->a90\""; 37 42 } … … 75 80 76 81 function test_export_entry() { 77 82 $po = new PO(); 83 78 84 $entry = new Translation_Entry(array('singular' => 'baba')); 79 85 $this->assertEquals("msgid \"baba\"\nmsgstr \"\"", $po->export_entry($entry)); 86 80 87 // plural 81 88 $entry = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas')); 82 $ this->assertEquals('msgid "baba"89 $expected = 'msgid "baba" 83 90 msgid_plural "babas" 84 91 msgstr[0] "" 85 msgstr[1] ""', $po->export_entry($entry)); 92 msgstr[1] ""'; 93 $expected = str_replace( "\r\n", "\n", $expected ); 94 $this->assertEquals($expected, $po->export_entry($entry)); 95 86 96 $entry = new Translation_Entry(array('singular' => 'baba', 'translator_comments' => "baba\ndyado")); 87 $ this->assertEquals('# baba97 $expected = '# baba 88 98 # dyado 89 99 msgid "baba" 90 msgstr ""', $po->export_entry($entry)); 100 msgstr ""'; 101 $expected = str_replace( "\r\n", "\n", $expected ); 102 $this->assertEquals($expected, $po->export_entry($entry)); 103 91 104 $entry = new Translation_Entry(array('singular' => 'baba', 'extracted_comments' => "baba")); 92 $ this->assertEquals('#. baba105 $expected = '#. baba 93 106 msgid "baba" 94 msgstr ""', $po->export_entry($entry)); 107 msgstr ""'; 108 $expected = str_replace( "\r\n", "\n", $expected ); 109 $this->assertEquals($expected, $po->export_entry($entry)); 110 95 111 $entry = new Translation_Entry(array( 96 112 'singular' => 'baba', 97 113 'extracted_comments' => "baba", 98 114 'references' => range(1, 29))); 99 $ this->assertEquals('#. baba115 $expected = '#. baba 100 116 #: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 101 117 #: 29 102 118 msgid "baba" 103 msgstr ""', $po->export_entry($entry)); 119 msgstr ""'; 120 $expected = str_replace( "\r\n", "\n", $expected ); 121 $this->assertEquals($expected, $po->export_entry($entry)); 122 104 123 $entry = new Translation_Entry(array('singular' => 'baba', 'translations' => array())); 105 124 $this->assertEquals("msgid \"baba\"\nmsgstr \"\"", $po->export_entry($entry)); 106 125 … … 108 127 $this->assertEquals("msgid \"baba\"\nmsgstr \"куку\"", $po->export_entry($entry)); 109 128 110 129 $entry = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas', 'translations' => array('кукубуку'))); 111 $ this->assertEquals('msgid "baba"130 $expected = 'msgid "baba" 112 131 msgid_plural "babas" 113 msgstr[0] "кукубуку"', $po->export_entry($entry)); 132 msgstr[0] "кукубуку"'; 133 $expected = str_replace( "\r\n", "\n", $expected ); 134 $this->assertEquals($expected, $po->export_entry($entry)); 114 135 115 136 $entry = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas', 'translations' => array('кукубуку', 'кукуруку', 'бабаяга'))); 116 $ this->assertEquals('msgid "baba"137 $expected = 'msgid "baba" 117 138 msgid_plural "babas" 118 139 msgstr[0] "кукубуку" 119 140 msgstr[1] "кукуруку" 120 msgstr[2] "бабаяга"', $po->export_entry($entry)); 141 msgstr[2] "бабаяга"'; 142 $expected = str_replace( "\r\n", "\n", $expected ); 143 $this->assertEquals($expected, $po->export_entry($entry)); 144 121 145 // context 122 146 $entry = new Translation_Entry(array('context' => 'ctxt', 'singular' => 'baba', 'plural' => 'babas', 'translations' => array('кукубуку', 'кукуруку', 'бабаяга'), 'flags' => array('fuzzy', 'php-format'))); 123 $ this->assertEquals('#, fuzzy, php-format147 $expected = '#, fuzzy, php-format 124 148 msgctxt "ctxt" 125 149 msgid "baba" 126 150 msgid_plural "babas" 127 151 msgstr[0] "кукубуку" 128 152 msgstr[1] "кукуруку" 129 msgstr[2] "бабаяга"', $po->export_entry($entry)); 153 msgstr[2] "бабаяга"'; 154 $expected = str_replace( "\r\n", "\n", $expected ); 155 $this->assertEquals($expected, $po->export_entry($entry)); 130 156 } 131 157 132 158 function test_export_entries() { -
tests/phpunit/tests/post/listPages.php
65 65 </ul> 66 66 </li> 67 67 </ul></li>'; 68 $expected['default'] = str_replace( "\r\n", "\n", $expected['default'] ); 68 69 $actual = wp_list_pages( $args ); 69 70 $this->AssertEquals( $expected['default'], $actual ); 70 71 } … … 78 79 <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a></li> 79 80 <li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li> 80 81 </ul></li>'; 82 $expected['depth'] = str_replace( "\r\n", "\n", $expected['depth'] ); 81 83 $actual = wp_list_pages( $args ); 82 84 $this->AssertEquals( $expected['depth'], $actual ); 83 85 } … … 92 94 <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a> ' . date( 'F j, Y' ) . '</li> 93 95 <li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a> ' . date( 'F j, Y' ) . '</li> 94 96 </ul></li>'; 97 $expected['show_date'] = str_replace( "\r\n", "\n", $expected['show_date'] ); 95 98 $actual = wp_list_pages( $args ); 96 99 $this->AssertEquals( $expected['show_date'], $actual ); 97 100 } … … 124 127 </ul> 125 128 </li> 126 129 </ul></li>'; 130 $expected['date_format'] = str_replace( "\r\n", "\n", $expected['date_format'] ); 127 131 $actual = wp_list_pages( $args ); 128 132 $this->AssertEquals( $expected['date_format'], $actual ); 129 133 } … … 137 141 <li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li> 138 142 <li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li> 139 143 </ul></li>'; 144 $expected['child_of'] = str_replace( "\r\n", "\n", $expected['child_of'] ); 140 145 $actual = wp_list_pages( $args ); 141 146 $this->AssertEquals( $expected['child_of'], $actual ); 142 147 } … … 164 169 <li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li> 165 170 <li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li> 166 171 </ul></li>'; 172 $expected['exclude'] = str_replace( "\r\n", "\n", $expected['exclude'] ); 167 173 $actual = wp_list_pages( $args ); 168 174 $this->AssertEquals( $expected['exclude'], $actual ); 169 175 } … … 178 184 <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a></li> 179 185 <li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li> 180 186 </ul></li>'; 187 $expected['title_li'] = str_replace( "\r\n", "\n", $expected['title_li'] ); 181 188 $actual = wp_list_pages( $args ); 182 189 $this->AssertEquals( $expected['title_li'], $actual ); 183 190 } … … 191 198 <li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a></li> 192 199 <li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li> 193 200 </ul></li>'; 201 $expected['echo'] = str_replace( "\r\n", "\n", $expected['echo'] ); 194 202 ob_start(); 195 203 wp_list_pages( $args ); 196 204 $actual = ob_get_clean(); … … 204 212 ); 205 213 $expected['authors'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-3"><a href="' . get_permalink( 3) . '">Parent 3</a></li> 206 214 </ul></li>'; 215 $expected['authors'] = str_replace( "\r\n", "\n", $expected['authors'] ); 207 216 $actual = wp_list_pages( $args ); 208 217 $this->AssertEquals( $expected['authors'], $actual ); 209 218 } … … 215 224 ); 216 225 $expected['number'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li> 217 226 </ul></li>'; 227 $expected['number'] = str_replace( "\r\n", "\n", $expected['number'] ); 218 228 $actual = wp_list_pages( $args ); 219 229 $this->AssertEquals( $expected['number'], $actual ); 220 230 } … … 247 257 </ul> 248 258 </li> 249 259 </ul></li>'; 260 $expected['sort_column'] = str_replace( "\r\n", "\n", $expected['sort_column'] ); 250 261 $actual = wp_list_pages( $args ); 251 262 $this->AssertEquals( $expected['sort_column'], $actual ); 252 263 } … … 278 289 </ul> 279 290 </li> 280 291 </ul></li>'; 292 $expected['link_before'] = str_replace( "\r\n", "\n", $expected['link_before'] ); 281 293 $actual = wp_list_pages( $args ); 282 294 $this->AssertEquals( $expected['link_before'], $actual ); 283 295 } … … 309 321 </ul> 310 322 </li> 311 323 </ul></li>'; 324 $expected['link_after'] = str_replace( "\r\n", "\n", $expected['link_after'] ); 312 325 $actual = wp_list_pages( $args ); 313 326 $this->AssertEquals( $expected['link_after'], $actual ); 314 327 } … … 322 335 $expected['include'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1"><a href="' . get_permalink( 1 ) . '">Parent 1</a></li> 323 336 <li class="page_item page-item-3"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li> 324 337 </ul></li>'; 338 $expected['include'] = str_replace( "\r\n", "\n", $expected['include'] ); 325 339 $actual = wp_list_pages( $args ); 326 340 $this->AssertEquals( $expected['include'], $actual ); 327 341 } … … 339 353 </ul> 340 354 </li> 341 355 </ul></li>'; 356 $expected['exclude'] = str_replace( "\r\n", "\n", $expected['exclude'] ); 342 357 $actual = wp_list_pages( $args ); 343 358 $this->AssertEquals( $expected['exclude'], $actual ); 344 359 } -
tests/phpunit/tests/post/template.php
90 90 </select> 91 91 92 92 LINEAGE; 93 $lineage = str_replace( "\r\n", "\n", $lineage ); 93 94 94 95 $output = wp_dropdown_pages( array( 'echo' => 0 ) ); 95 96 $this->assertEquals( $lineage, $output ); … … 100 101 </select> 101 102 102 103 DEPTH; 104 $depth = str_replace( "\r\n", "\n", $depth ); 103 105 104 106 $output = wp_dropdown_pages( array( 'echo' => 0, 'depth' => 1 ) ); 105 107 $this->assertEquals( $depth, $output ); … … 111 113 </select> 112 114 113 115 NONE; 116 $option_none = str_replace( "\r\n", "\n", $option_none ); 114 117 115 118 $output = wp_dropdown_pages( array( 'echo' => 0, 'depth' => 1, 116 119 'show_option_none' => 'Hoo', 'option_none_value' => 'Woo' … … 125 128 </select> 126 129 127 130 NO; 131 $option_no_change = str_replace( "\r\n", "\n", $option_no_change ); 132 128 133 $output = wp_dropdown_pages( array( 'echo' => 0, 'depth' => 1, 129 134 'show_option_none' => 'Hoo', 'option_none_value' => 'Woo', 130 135 'show_option_no_change' => 'Burrito'