Make WordPress Core

Ticket #31432: 31432.patch

File 31432.patch, 14.1 KB (added by SergeyBiryukov, 10 years ago)
  • tests/phpunit/tests/dependencies/styles.php

     
    220220<![endif]-->
    221221
    222222CSS;
     223                $expected = str_replace( "\r\n", "\n", $expected );
     224
    223225                wp_enqueue_style( 'handle', 'http://example.com', array(), 1 );
    224226                wp_style_add_data( 'handle', 'conditional', 'IE' );
    225227                wp_add_inline_style( 'handle', 'a { color: blue; }' );
  • tests/phpunit/tests/functions/getArchives.php

     
    4545        <li><a href='$link4'>Post title 5</a></li>
    4646        <li><a href='$link5'>Post title 4</a></li>
    4747EOF;
     48                $expected['limit'] = str_replace( "\r\n", "\n", $expected['limit'] );
     49
    4850                $this->assertEquals( $expected['limit'], trim( wp_get_archives( array( 'echo' => false, 'type' => 'postbypost', 'limit' => 5 ) ) ) );
    4951        }
    5052
     
    8082<li><a href='{$oct_url}'>October 2012</a></li>
    8183        <li><a href='{$this->month_url}'>$date_full</a></li>
    8284EOF;
     85                $expected['order_asc'] = str_replace( "\r\n", "\n", $expected['order_asc'] );
     86
    8387                $this->assertEquals( $expected['order_asc'], trim( wp_get_archives( array( 'echo' => false, 'order' => 'ASC' ) ) ) );
    8488
    8589                $expected['order_desc'] = <<<EOF
     
    8690<li><a href='{$this->month_url}'>$date_full</a></li>
    8791        <li><a href='{$oct_url}'>October 2012</a></li>
    8892EOF;
     93                $expected['order_desc'] = str_replace( "\r\n", "\n", $expected['order_desc'] );
     94
    8995                $this->assertEquals( $expected['order_desc'], trim( wp_get_archives( array( 'echo' => false, 'order' => 'DESC' ) ) ) );
    9096        }
    9197}
  • tests/phpunit/tests/general/paginateLinks.php

     
    3333<a class='page-numbers' href='$page50'>50</a>
    3434<a class="next page-numbers" href="$page2">Next &raquo;</a>
    3535EXPECTED;
     36                $expected = str_replace( "\r\n", "\n", $expected );
    3637
    3738                $links = paginate_links( array( 'total' => 50 ) );
    3839                $this->assertEquals( $expected, $links );
     
    5152<a class='page-numbers' href='$page50'>50</a>
    5253<a class="next page-numbers" href="$page2">Next &raquo;</a>
    5354EXPECTED;
     55                $expected = str_replace( "\r\n", "\n", $expected );
    5456
    5557                $links = paginate_links( array( 'total' => 50, 'format' => 'page/%#%/' ) );
    5658                $this->assertEquals( $expected, $links );
     
    7072<span class="page-numbers dots">&hellip;</span>
    7173<a class='page-numbers' href='$page50'>50</a>
    7274EXPECTED;
     75                $expected = str_replace( "\r\n", "\n", $expected );
    7376
    7477                $links = paginate_links( array( 'total' => 50, 'prev_next' => false, 'current' => 2 ) );
    7578                $this->assertEquals( $expected, $links );
     
    9194<a class='page-numbers' href='$page50'>50</a>
    9295<a class="next page-numbers" href="$page3">Next &raquo;</a>
    9396EXPECTED;
     97                $expected = str_replace( "\r\n", "\n", $expected );
    9498
    9599                $links = paginate_links( array( 'total' => 50, 'prev_next' => true, 'current' => 2 ) );
    96100                $this->assertEquals( $expected, $links );
  • tests/phpunit/tests/pomo/po.php

     
    33class Tests_POMO_PO extends WP_UnitTestCase {
    44        function setUp() {
    55                require_once ABSPATH . '/wp-includes/pomo/po.php';
     6
    67                // not so random wordpress.pot string -- multiple lines
    78                $this->mail = "Your new WordPress blog has been successfully set up at:
    89
     
    1819--The WordPress Team
    1920http://wordpress.org/
    2021";
     22                $this->mail = str_replace( "\r\n", "\n", $this->mail );
     23
    2124        $this->po_mail = '""
    2225"Your new WordPress blog has been successfully set up at:\n"
    2326"\n"
     
    3235"\n"
    3336"--The WordPress Team\n"
    3437"http://wordpress.org/\n"';
     38                $this->po_mail = str_replace( "\r\n", "\n", $this->po_mail );
     39
    3540                $this->a90 = str_repeat("a", 90);
    3641                $this->po_a90 = "\"$this->a90\"";
    3742    }
     
    7580
    7681        function test_export_entry() {
    7782                $po = new PO();
     83
    7884                $entry = new Translation_Entry(array('singular' => 'baba'));
    7985                $this->assertEquals("msgid \"baba\"\nmsgstr \"\"", $po->export_entry($entry));
     86
    8087                // plural
    8188                $entry = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas'));
    82                 $this->assertEquals('msgid "baba"
     89                $expected = 'msgid "baba"
    8390msgid_plural "babas"
    8491msgstr[0] ""
    85 msgstr[1] ""', $po->export_entry($entry));
     92msgstr[1] ""';
     93                $expected = str_replace( "\r\n", "\n", $expected );
     94                $this->assertEquals($expected, $po->export_entry($entry));
     95
    8696                $entry = new Translation_Entry(array('singular' => 'baba', 'translator_comments' => "baba\ndyado"));
    87                 $this->assertEquals('#  baba
     97                $expected = '#  baba
    8898#  dyado
    8999msgid "baba"
    90 msgstr ""', $po->export_entry($entry));
     100msgstr ""';
     101                $expected = str_replace( "\r\n", "\n", $expected );
     102                $this->assertEquals($expected, $po->export_entry($entry));
     103
    91104                $entry = new Translation_Entry(array('singular' => 'baba', 'extracted_comments' => "baba"));
    92                 $this->assertEquals('#. baba
     105                $expected = '#. baba
    93106msgid "baba"
    94 msgstr ""', $po->export_entry($entry));
     107msgstr ""';
     108                $expected = str_replace( "\r\n", "\n", $expected );
     109                $this->assertEquals($expected, $po->export_entry($entry));
     110
    95111                $entry = new Translation_Entry(array(
    96112                        'singular' => 'baba',
    97113                        'extracted_comments' => "baba",
    98114                        'references' => range(1, 29)));
    99                 $this->assertEquals('#. baba
     115                $expected = '#. baba
    100116#: 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
    101117#: 29
    102118msgid "baba"
    103 msgstr ""', $po->export_entry($entry));
     119msgstr ""';
     120                $expected = str_replace( "\r\n", "\n", $expected );
     121                $this->assertEquals($expected, $po->export_entry($entry));
     122
    104123                $entry = new Translation_Entry(array('singular' => 'baba', 'translations' => array()));
    105124                $this->assertEquals("msgid \"baba\"\nmsgstr \"\"", $po->export_entry($entry));
    106125
     
    108127                $this->assertEquals("msgid \"baba\"\nmsgstr \"куку\"", $po->export_entry($entry));
    109128
    110129                $entry = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas', 'translations' => array('кукубуку')));
    111                 $this->assertEquals('msgid "baba"
     130                $expected = 'msgid "baba"
    112131msgid_plural "babas"
    113 msgstr[0] "кукубуку"', $po->export_entry($entry));
     132msgstr[0] "кукубуку"';
     133                $expected = str_replace( "\r\n", "\n", $expected );
     134                $this->assertEquals($expected, $po->export_entry($entry));
    114135
    115136                $entry = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas', 'translations' => array('кукубуку', 'кукуруку', 'бабаяга')));
    116                 $this->assertEquals('msgid "baba"
     137                $expected = 'msgid "baba"
    117138msgid_plural "babas"
    118139msgstr[0] "кукубуку"
    119140msgstr[1] "кукуруку"
    120 msgstr[2] "бабаяга"', $po->export_entry($entry));
     141msgstr[2] "бабаяга"';
     142                $expected = str_replace( "\r\n", "\n", $expected );
     143                $this->assertEquals($expected, $po->export_entry($entry));
     144
    121145                // context
    122146                $entry = new Translation_Entry(array('context' => 'ctxt', 'singular' => 'baba', 'plural' => 'babas', 'translations' => array('кукубуку', 'кукуруку', 'бабаяга'), 'flags' => array('fuzzy', 'php-format')));
    123                 $this->assertEquals('#, fuzzy, php-format
     147                $expected = '#, fuzzy, php-format
    124148msgctxt "ctxt"
    125149msgid "baba"
    126150msgid_plural "babas"
    127151msgstr[0] "кукубуку"
    128152msgstr[1] "кукуруку"
    129 msgstr[2] "бабаяга"', $po->export_entry($entry));
     153msgstr[2] "бабаяга"';
     154                $expected = str_replace( "\r\n", "\n", $expected );
     155                $this->assertEquals($expected, $po->export_entry($entry));
    130156    }
    131157
    132158        function test_export_entries() {
  • tests/phpunit/tests/post/listPages.php

     
    6565</ul>
    6666</li>
    6767</ul></li>';
     68                $expected['default'] = str_replace( "\r\n", "\n", $expected['default'] );
    6869                $actual = wp_list_pages( $args );
    6970                $this->AssertEquals( $expected['default'], $actual );
    7071        }
     
    7879<li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a></li>
    7980<li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li>
    8081</ul></li>';
     82                $expected['depth'] = str_replace( "\r\n", "\n", $expected['depth'] );
    8183                $actual = wp_list_pages( $args );
    8284                $this->AssertEquals( $expected['depth'], $actual );
    8385        }
     
    9294<li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a> ' . date( 'F j, Y' ) . '</li>
    9395<li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a> ' . date( 'F j, Y' ) . '</li>
    9496</ul></li>';
     97                $expected['show_date'] = str_replace( "\r\n", "\n", $expected['show_date'] );
    9598                $actual = wp_list_pages( $args );
    9699                $this->AssertEquals( $expected['show_date'], $actual );
    97100        }
     
    124127</ul>
    125128</li>
    126129</ul></li>';
     130                $expected['date_format'] = str_replace( "\r\n", "\n", $expected['date_format'] );
    127131                $actual = wp_list_pages( $args );
    128132                $this->AssertEquals( $expected['date_format'], $actual );
    129133        }
     
    137141<li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li>
    138142<li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li>
    139143</ul></li>';
     144                $expected['child_of'] = str_replace( "\r\n", "\n", $expected['child_of'] );
    140145                $actual = wp_list_pages( $args );
    141146                $this->AssertEquals( $expected['child_of'], $actual );
    142147        }
     
    164169<li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li>
    165170<li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li>
    166171</ul></li>';
     172                $expected['exclude'] = str_replace( "\r\n", "\n", $expected['exclude'] );
    167173                $actual = wp_list_pages( $args );
    168174                $this->AssertEquals( $expected['exclude'], $actual );
    169175        }
     
    178184<li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a></li>
    179185<li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li>
    180186</ul></li>';
     187                $expected['title_li'] = str_replace( "\r\n", "\n", $expected['title_li'] );
    181188                $actual = wp_list_pages( $args );
    182189                $this->AssertEquals( $expected['title_li'], $actual );
    183190        }
     
    191198<li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a></li>
    192199<li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li>
    193200</ul></li>';
     201                $expected['echo'] = str_replace( "\r\n", "\n", $expected['echo'] );
    194202                ob_start();
    195203                wp_list_pages( $args );
    196204                $actual = ob_get_clean();
     
    204212                );
    205213                $expected['authors'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-3"><a href="' . get_permalink( 3) . '">Parent 3</a></li>
    206214</ul></li>';
     215                $expected['authors'] = str_replace( "\r\n", "\n", $expected['authors'] );
    207216                $actual = wp_list_pages( $args );
    208217                $this->AssertEquals( $expected['authors'], $actual );
    209218        }
     
    215224                );
    216225                $expected['number'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li>
    217226</ul></li>';
     227                $expected['number'] = str_replace( "\r\n", "\n", $expected['number'] );
    218228                $actual = wp_list_pages( $args );
    219229                $this->AssertEquals( $expected['number'], $actual );
    220230        }
     
    247257</ul>
    248258</li>
    249259</ul></li>';
     260                $expected['sort_column'] = str_replace( "\r\n", "\n", $expected['sort_column'] );
    250261                $actual = wp_list_pages( $args );
    251262                $this->AssertEquals( $expected['sort_column'], $actual );
    252263        }
     
    278289</ul>
    279290</li>
    280291</ul></li>';
     292                $expected['link_before'] = str_replace( "\r\n", "\n", $expected['link_before'] );
    281293                $actual = wp_list_pages( $args );
    282294                $this->AssertEquals( $expected['link_before'], $actual );
    283295        }
     
    309321</ul>
    310322</li>
    311323</ul></li>';
     324                $expected['link_after'] = str_replace( "\r\n", "\n", $expected['link_after'] );
    312325                $actual = wp_list_pages( $args );
    313326                $this->AssertEquals( $expected['link_after'], $actual );
    314327        }
     
    322335                $expected['include'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1"><a href="' . get_permalink( 1 ) . '">Parent 1</a></li>
    323336<li class="page_item page-item-3"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li>
    324337</ul></li>';
     338                $expected['include'] = str_replace( "\r\n", "\n", $expected['include'] );
    325339                $actual = wp_list_pages( $args );
    326340                $this->AssertEquals( $expected['include'], $actual );
    327341        }
     
    339353</ul>
    340354</li>
    341355</ul></li>';
     356                $expected['exclude'] = str_replace( "\r\n", "\n", $expected['exclude'] );
    342357                $actual = wp_list_pages( $args );
    343358                $this->AssertEquals( $expected['exclude'], $actual );
    344359        }
  • tests/phpunit/tests/post/template.php

     
    9090</select>
    9191
    9292LINEAGE;
     93                $lineage = str_replace( "\r\n", "\n", $lineage );
    9394
    9495                $output = wp_dropdown_pages( array( 'echo' => 0 ) );
    9596                $this->assertEquals( $lineage, $output );
     
    100101</select>
    101102
    102103DEPTH;
     104                $depth = str_replace( "\r\n", "\n", $depth );
    103105
    104106                $output = wp_dropdown_pages( array( 'echo' => 0, 'depth' => 1 ) );
    105107                $this->assertEquals( $depth, $output );
     
    111113</select>
    112114
    113115NONE;
     116                $option_none = str_replace( "\r\n", "\n", $option_none );
    114117
    115118                $output = wp_dropdown_pages( array( 'echo' => 0, 'depth' => 1,
    116119                        'show_option_none' => 'Hoo', 'option_none_value' => 'Woo'
     
    125128</select>
    126129
    127130NO;
     131                $option_no_change = str_replace( "\r\n", "\n", $option_no_change );
     132
    128133                $output = wp_dropdown_pages( array( 'echo' => 0, 'depth' => 1,
    129134                        'show_option_none' => 'Hoo', 'option_none_value' => 'Woo',
    130135                        'show_option_no_change' => 'Burrito'