Build/Test Tools: Ignore EOL differences in tests using multiline string assertions.
Unix vs. Windows EOL style mismatches can cause misleading failures in tests using the heredoc syntax (`<<<`) or multiline strings as the expected result. Fixes #31432. See #42594, #47411. git-svn-id: https://develop.svn.wordpress.org/trunk@46612 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c6c46a5a48
commit
b0419afba6
@ -635,6 +635,18 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Framework_TestCase {
|
|||||||
$this->assertEquals( preg_replace( '/\s*/', '', $expected ), preg_replace( '/\s*/', '', $actual ) );
|
$this->assertEquals( preg_replace( '/\s*/', '', $expected ), preg_replace( '/\s*/', '', $actual ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asserts that two values are equal, with EOL differences discarded.
|
||||||
|
*
|
||||||
|
* @since 5.4.0
|
||||||
|
*
|
||||||
|
* @param string $expected The expected value.
|
||||||
|
* @param string $actual The actual value.
|
||||||
|
*/
|
||||||
|
public function assertEqualsIgnoreEOL( $expected, $actual ) {
|
||||||
|
$this->assertEquals( str_replace( "\r\n", "\n", $expected ), str_replace( "\r\n", "\n", $actual ) );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asserts that the contents of two un-keyed, single arrays are equal, without accounting for the order of elements.
|
* Asserts that the contents of two un-keyed, single arrays are equal, without accounting for the order of elements.
|
||||||
*
|
*
|
||||||
|
@ -60,7 +60,7 @@ class WP_Test_Block_Render extends WP_UnitTestCase {
|
|||||||
|
|
||||||
$actual_html = do_blocks( $original_html );
|
$actual_html = do_blocks( $original_html );
|
||||||
|
|
||||||
$this->assertEquals( $expected_html, $actual_html );
|
$this->assertEqualsIgnoreEOL( $expected_html, $actual_html );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -846,7 +846,7 @@ JS;
|
|||||||
);
|
);
|
||||||
$expected .= "<script type='text/javascript' src='/wp-includes/js/script.js'></script>\n";
|
$expected .= "<script type='text/javascript' src='/wp-includes/js/script.js'></script>\n";
|
||||||
|
|
||||||
$this->assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
|
$this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_scripts' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -871,7 +871,7 @@ JS;
|
|||||||
);
|
);
|
||||||
$expected .= "<script type='text/javascript' src='/wp-content/plugins/my-plugin/js/script.js'></script>\n";
|
$expected .= "<script type='text/javascript' src='/wp-content/plugins/my-plugin/js/script.js'></script>\n";
|
||||||
|
|
||||||
$this->assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
|
$this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_scripts' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -896,7 +896,7 @@ JS;
|
|||||||
);
|
);
|
||||||
$expected .= "<script type='text/javascript' src='/wp-content/themes/my-theme/js/script.js'></script>\n";
|
$expected .= "<script type='text/javascript' src='/wp-content/themes/my-theme/js/script.js'></script>\n";
|
||||||
|
|
||||||
$this->assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
|
$this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_scripts' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -921,7 +921,7 @@ JS;
|
|||||||
);
|
);
|
||||||
$expected .= "<script type='text/javascript' src='/wp-admin/js/script.js'></script>\n";
|
$expected .= "<script type='text/javascript' src='/wp-admin/js/script.js'></script>\n";
|
||||||
|
|
||||||
$this->assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
|
$this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_scripts' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -961,7 +961,7 @@ JS;
|
|||||||
);
|
);
|
||||||
$expected .= "<script type='text/javascript' src='/wp-admin/js/script.js'></script>\n";
|
$expected .= "<script type='text/javascript' src='/wp-admin/js/script.js'></script>\n";
|
||||||
|
|
||||||
$this->assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
|
$this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_scripts' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -988,7 +988,7 @@ JS;
|
|||||||
);
|
);
|
||||||
$expected .= "<script type='text/javascript' src='/wp-includes/js/script.js'></script>\n";
|
$expected .= "<script type='text/javascript' src='/wp-includes/js/script.js'></script>\n";
|
||||||
|
|
||||||
$this->assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
|
$this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_scripts' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1016,7 +1016,7 @@ JS;
|
|||||||
$expected .= "<script type='text/javascript' src='/wp-includes/js/script.js'></script>\n";
|
$expected .= "<script type='text/javascript' src='/wp-includes/js/script.js'></script>\n";
|
||||||
$expected .= "<script type='text/javascript' src='/wp-includes/js/script2.js'></script>\n";
|
$expected .= "<script type='text/javascript' src='/wp-includes/js/script2.js'></script>\n";
|
||||||
|
|
||||||
$this->assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
|
$this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_scripts' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -272,7 +272,7 @@ CSS;
|
|||||||
wp_style_add_data( 'handle', 'conditional', 'IE' );
|
wp_style_add_data( 'handle', 'conditional', 'IE' );
|
||||||
wp_add_inline_style( 'handle', 'a { color: blue; }' );
|
wp_add_inline_style( 'handle', 'a { color: blue; }' );
|
||||||
|
|
||||||
$this->assertEquals( $expected, get_echo( 'wp_print_styles' ) );
|
$this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_styles' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -502,7 +502,7 @@ line 3<br />
|
|||||||
line 4<br />
|
line 4<br />
|
||||||
line 5</p>';
|
line 5</p>';
|
||||||
|
|
||||||
$this->assertEquals( $expected, trim( wpautop( $content ) ) );
|
$this->assertEqualsIgnoreEOL( $expected, trim( wpautop( $content ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -521,7 +521,7 @@ line 2<br/>
|
|||||||
$expected = '<p>line 1</p>
|
$expected = '<p>line 1</p>
|
||||||
<p>line 2</p>';
|
<p>line 2</p>';
|
||||||
|
|
||||||
$this->assertEquals( $expected, trim( wpautop( $content ) ) );
|
$this->assertEqualsIgnoreEOL( $expected, trim( wpautop( $content ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -543,7 +543,7 @@ line 2<br/>
|
|||||||
*
|
*
|
||||||
* @ticket 39307
|
* @ticket 39307
|
||||||
*/
|
*/
|
||||||
function test_that_wpautop_doses_not_add_extra_closing_p_in_figure() {
|
function test_that_wpautop_does_not_add_extra_closing_p_in_figure() {
|
||||||
$content1 = '<figure><img src="example.jpg" /><figcaption>Caption</figcaption></figure>';
|
$content1 = '<figure><img src="example.jpg" /><figcaption>Caption</figcaption></figure>';
|
||||||
$expected1 = $content1;
|
$expected1 = $content1;
|
||||||
|
|
||||||
@ -556,7 +556,7 @@ line 2<br/>
|
|||||||
<img src="example.jpg" /><figcaption>Caption</figcaption></figure>';
|
<img src="example.jpg" /><figcaption>Caption</figcaption></figure>';
|
||||||
|
|
||||||
$this->assertEquals( $expected1, trim( wpautop( $content1 ) ) );
|
$this->assertEquals( $expected1, trim( wpautop( $content1 ) ) );
|
||||||
$this->assertEquals( $expected2, trim( wpautop( $content2 ) ) );
|
$this->assertEqualsIgnoreEOL( $expected2, trim( wpautop( $content2 ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -584,7 +584,7 @@ line 2<br/>
|
|||||||
|
|
||||||
$expected = '<p>' . $content . '</p>';
|
$expected = '<p>' . $content . '</p>';
|
||||||
|
|
||||||
$this->assertEquals( $expected, trim( wpautop( $content ) ) );
|
$this->assertEqualsIgnoreEOL( $expected, trim( wpautop( $content ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -600,6 +600,6 @@ line 2<br/>
|
|||||||
|
|
||||||
$expected = '<p>' . $content . '</p>';
|
$expected = '<p>' . $content . '</p>';
|
||||||
|
|
||||||
$this->assertEquals( $expected, trim( wpautop( $content ) ) );
|
$this->assertEqualsIgnoreEOL( $expected, trim( wpautop( $content ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,6 +209,7 @@ Hi there,
|
|||||||
|
|
||||||
I thought you might want to sign up for this newsletter
|
I thought you might want to sign up for this newsletter
|
||||||
EOT;
|
EOT;
|
||||||
|
$body = str_replace( "\r\n", "\n", $body );
|
||||||
$email_link = 'mailto:?body=' . rawurlencode( $body );
|
$email_link = 'mailto:?body=' . rawurlencode( $body );
|
||||||
$email_link = esc_url( $email_link );
|
$email_link = esc_url( $email_link );
|
||||||
$this->assertEquals( 'mailto:?body=Hi%20there%2C%0A%0AI%20thought%20you%20might%20want%20to%20sign%20up%20for%20this%20newsletter', $email_link );
|
$this->assertEquals( 'mailto:?body=Hi%20there%2C%0A%0AI%20thought%20you%20might%20want%20to%20sign%20up%20for%20this%20newsletter', $email_link );
|
||||||
@ -223,6 +224,7 @@ Hi there,
|
|||||||
|
|
||||||
I thought you might want to sign up for this newsletter
|
I thought you might want to sign up for this newsletter
|
||||||
EOT;
|
EOT;
|
||||||
|
$body = str_replace( "\r\n", "\n", $body );
|
||||||
$email_link = 'http://example.com/mailto:?body=' . rawurlencode( $body );
|
$email_link = 'http://example.com/mailto:?body=' . rawurlencode( $body );
|
||||||
$email_link = esc_url( $email_link );
|
$email_link = esc_url( $email_link );
|
||||||
$this->assertEquals( 'http://example.com/mailto:?body=Hi%20there%2CI%20thought%20you%20might%20want%20to%20sign%20up%20for%20this%20newsletter', $email_link );
|
$this->assertEquals( 'http://example.com/mailto:?body=Hi%20there%2CI%20thought%20you%20might%20want%20to%20sign%20up%20for%20this%20newsletter', $email_link );
|
||||||
|
@ -137,7 +137,7 @@ class Tests_Formatting_SanitizeTextField extends WP_UnitTestCase {
|
|||||||
$expected_multiline = $expected;
|
$expected_multiline = $expected;
|
||||||
}
|
}
|
||||||
$this->assertEquals( $expected_oneline, sanitize_text_field( $string ) );
|
$this->assertEquals( $expected_oneline, sanitize_text_field( $string ) );
|
||||||
$this->assertEquals( $expected_multiline, sanitize_textarea_field( $string ) );
|
$this->assertEqualsIgnoreEOL( $expected_multiline, sanitize_textarea_field( $string ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ class Tests_Get_Archives extends WP_UnitTestCase {
|
|||||||
<li><a href='$link4'>$title4</a></li>
|
<li><a href='$link4'>$title4</a></li>
|
||||||
<li><a href='$link5'>$title5</a></li>
|
<li><a href='$link5'>$title5</a></li>
|
||||||
EOF;
|
EOF;
|
||||||
$this->assertEquals(
|
$this->assertEqualsIgnoreEOL(
|
||||||
$expected['limit'],
|
$expected['limit'],
|
||||||
trim(
|
trim(
|
||||||
wp_get_archives(
|
wp_get_archives(
|
||||||
@ -153,7 +153,7 @@ EOF;
|
|||||||
<li><a href='{$oct_url}'>October 2012</a></li>
|
<li><a href='{$oct_url}'>October 2012</a></li>
|
||||||
<li><a href='{$this->month_url}'>$date_full</a></li>
|
<li><a href='{$this->month_url}'>$date_full</a></li>
|
||||||
EOF;
|
EOF;
|
||||||
$this->assertEquals(
|
$this->assertEqualsIgnoreEOL(
|
||||||
$expected['order_asc'],
|
$expected['order_asc'],
|
||||||
trim(
|
trim(
|
||||||
wp_get_archives(
|
wp_get_archives(
|
||||||
@ -169,7 +169,7 @@ EOF;
|
|||||||
<li><a href='{$this->month_url}'>$date_full</a></li>
|
<li><a href='{$this->month_url}'>$date_full</a></li>
|
||||||
<li><a href='{$oct_url}'>October 2012</a></li>
|
<li><a href='{$oct_url}'>October 2012</a></li>
|
||||||
EOF;
|
EOF;
|
||||||
$this->assertEquals(
|
$this->assertEqualsIgnoreEOL(
|
||||||
$expected['order_desc'],
|
$expected['order_desc'],
|
||||||
trim(
|
trim(
|
||||||
wp_get_archives(
|
wp_get_archives(
|
||||||
|
@ -25,7 +25,7 @@ class Tests_Paginate_Links extends WP_UnitTestCase {
|
|||||||
EXPECTED;
|
EXPECTED;
|
||||||
|
|
||||||
$links = paginate_links( array( 'total' => 50 ) );
|
$links = paginate_links( array( 'total' => 50 ) );
|
||||||
$this->assertEquals( $expected, $links );
|
$this->assertEqualsIgnoreEOL( $expected, $links );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_format() {
|
function test_format() {
|
||||||
@ -48,7 +48,7 @@ EXPECTED;
|
|||||||
'format' => 'page/%#%/',
|
'format' => 'page/%#%/',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals( $expected, $links );
|
$this->assertEqualsIgnoreEOL( $expected, $links );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_prev_next_false() {
|
function test_prev_next_false() {
|
||||||
@ -73,7 +73,7 @@ EXPECTED;
|
|||||||
'current' => 2,
|
'current' => 2,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals( $expected, $links );
|
$this->assertEqualsIgnoreEOL( $expected, $links );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_prev_next_true() {
|
function test_prev_next_true() {
|
||||||
@ -100,7 +100,7 @@ EXPECTED;
|
|||||||
'current' => 2,
|
'current' => 2,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals( $expected, $links );
|
$this->assertEqualsIgnoreEOL( $expected, $links );
|
||||||
}
|
}
|
||||||
|
|
||||||
function increment_i18n_count() {
|
function increment_i18n_count() {
|
||||||
|
@ -1249,7 +1249,7 @@ Stop.</p>
|
|||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
$result = apply_filters( 'the_content', $content );
|
$result = apply_filters( 'the_content', $content );
|
||||||
$this->assertEquals( $expected, $result );
|
$this->assertEqualsIgnoreEOL( $expected, $result );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,6 +22,7 @@ We hope you enjoy your new blog. Thanks!
|
|||||||
--The WordPress Team
|
--The WordPress Team
|
||||||
http://wordpress.org/
|
http://wordpress.org/
|
||||||
';
|
';
|
||||||
|
$this->mail = str_replace( "\r\n", "\n", $this->mail );
|
||||||
$this->po_mail = '""
|
$this->po_mail = '""
|
||||||
"Your new WordPress blog has been successfully set up at:\n"
|
"Your new WordPress blog has been successfully set up at:\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -63,7 +64,7 @@ http://wordpress.org/
|
|||||||
$src = 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.';
|
$src = 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.';
|
||||||
$this->assertEquals( '"Categories can be selectively converted to tags using the <a href=\\"%s\\">category to tag converter</a>."', $po->poify( $src ) );
|
$this->assertEquals( '"Categories can be selectively converted to tags using the <a href=\\"%s\\">category to tag converter</a>."', $po->poify( $src ) );
|
||||||
|
|
||||||
$this->assertEquals( $this->po_mail, $po->poify( $this->mail ) );
|
$this->assertEqualsIgnoreEOL( $this->po_mail, $po->poify( $this->mail ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_unpoify() {
|
function test_unpoify() {
|
||||||
@ -74,7 +75,7 @@ http://wordpress.org/
|
|||||||
$this->assertEquals( '\\t\\n', $po->unpoify( '"\\\\t\\\\n"' ) );
|
$this->assertEquals( '\\t\\n', $po->unpoify( '"\\\\t\\\\n"' ) );
|
||||||
// wordwrapped
|
// wordwrapped
|
||||||
$this->assertEquals( 'babadyado', $po->unpoify( "\"\"\n\"baba\"\n\"dyado\"" ) );
|
$this->assertEquals( 'babadyado', $po->unpoify( "\"\"\n\"baba\"\n\"dyado\"" ) );
|
||||||
$this->assertEquals( $this->mail, $po->unpoify( $this->po_mail ) );
|
$this->assertEqualsIgnoreEOL( $this->mail, $po->unpoify( $this->po_mail ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_export_entry() {
|
function test_export_entry() {
|
||||||
@ -88,7 +89,7 @@ http://wordpress.org/
|
|||||||
'plural' => 'babas',
|
'plural' => 'babas',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEqualsIgnoreEOL(
|
||||||
'msgid "baba"
|
'msgid "baba"
|
||||||
msgid_plural "babas"
|
msgid_plural "babas"
|
||||||
msgstr[0] ""
|
msgstr[0] ""
|
||||||
@ -101,7 +102,7 @@ msgstr[1] ""',
|
|||||||
'translator_comments' => "baba\ndyado",
|
'translator_comments' => "baba\ndyado",
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEqualsIgnoreEOL(
|
||||||
'# baba
|
'# baba
|
||||||
# dyado
|
# dyado
|
||||||
msgid "baba"
|
msgid "baba"
|
||||||
@ -114,7 +115,7 @@ msgstr ""',
|
|||||||
'extracted_comments' => 'baba',
|
'extracted_comments' => 'baba',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEqualsIgnoreEOL(
|
||||||
'#. baba
|
'#. baba
|
||||||
msgid "baba"
|
msgid "baba"
|
||||||
msgstr ""',
|
msgstr ""',
|
||||||
@ -127,7 +128,7 @@ msgstr ""',
|
|||||||
'references' => range( 1, 29 ),
|
'references' => range( 1, 29 ),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEqualsIgnoreEOL(
|
||||||
'#. baba
|
'#. baba
|
||||||
#: 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
|
#: 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
|
||||||
#: 29
|
#: 29
|
||||||
@ -158,7 +159,7 @@ msgstr ""',
|
|||||||
'translations' => array( 'кукубуку' ),
|
'translations' => array( 'кукубуку' ),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEqualsIgnoreEOL(
|
||||||
'msgid "baba"
|
'msgid "baba"
|
||||||
msgid_plural "babas"
|
msgid_plural "babas"
|
||||||
msgstr[0] "кукубуку"',
|
msgstr[0] "кукубуку"',
|
||||||
@ -172,7 +173,7 @@ msgstr[0] "кукубуку"',
|
|||||||
'translations' => array( 'кукубуку', 'кукуруку', 'бабаяга' ),
|
'translations' => array( 'кукубуку', 'кукуруку', 'бабаяга' ),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEqualsIgnoreEOL(
|
||||||
'msgid "baba"
|
'msgid "baba"
|
||||||
msgid_plural "babas"
|
msgid_plural "babas"
|
||||||
msgstr[0] "кукубуку"
|
msgstr[0] "кукубуку"
|
||||||
@ -190,7 +191,7 @@ msgstr[2] "бабаяга"',
|
|||||||
'flags' => array( 'fuzzy', 'php-format' ),
|
'flags' => array( 'fuzzy', 'php-format' ),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEqualsIgnoreEOL(
|
||||||
'#, fuzzy, php-format
|
'#, fuzzy, php-format
|
||||||
msgctxt "ctxt"
|
msgctxt "ctxt"
|
||||||
msgid "baba"
|
msgid "baba"
|
||||||
|
@ -134,7 +134,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
</li>
|
</li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_list_pages_depth() {
|
function test_wp_list_pages_depth() {
|
||||||
@ -148,7 +148,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
<li class="page_item page-item-' . self::$parent_3 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a></li>
|
<li class="page_item page-item-' . self::$parent_3 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a></li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_list_pages_show_date() {
|
function test_wp_list_pages_show_date() {
|
||||||
@ -164,7 +164,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
<li class="page_item page-item-' . self::$parent_3 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a> ' . $date . '</li>
|
<li class="page_item page-item-' . self::$parent_3 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a> ' . $date . '</li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_list_pages_date_format() {
|
function test_wp_list_pages_date_format() {
|
||||||
@ -198,7 +198,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
</li>
|
</li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_list_pages_child_of() {
|
function test_wp_list_pages_child_of() {
|
||||||
@ -212,7 +212,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
<li class="page_item page-item-' . self::$children[ self::$parent_2 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][2] ) . '">Child 3</a></li>
|
<li class="page_item page-item-' . self::$children[ self::$parent_2 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][2] ) . '">Child 3</a></li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_list_pages_exclude() {
|
function test_wp_list_pages_exclude() {
|
||||||
@ -240,7 +240,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
<li class="page_item page-item-' . self::$children[ self::$parent_2 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][2] ) . '">Child 3</a></li>
|
<li class="page_item page-item-' . self::$children[ self::$parent_2 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][2] ) . '">Child 3</a></li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_list_pages_title_li() {
|
function test_wp_list_pages_title_li() {
|
||||||
@ -255,7 +255,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
<li class="page_item page-item-' . self::$parent_3 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a></li>
|
<li class="page_item page-item-' . self::$parent_3 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a></li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_list_pages_echo() {
|
function test_wp_list_pages_echo() {
|
||||||
@ -268,6 +268,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
<li class="page_item page-item-' . self::$parent_2 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_2 ) . '">Parent 2</a></li>
|
<li class="page_item page-item-' . self::$parent_2 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_2 ) . '">Parent 2</a></li>
|
||||||
<li class="page_item page-item-' . self::$parent_3 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a></li>
|
<li class="page_item page-item-' . self::$parent_3 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a></li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
$expected = str_replace( "\r\n", "\n", $expected );
|
||||||
$this->expectOutputString( $expected );
|
$this->expectOutputString( $expected );
|
||||||
wp_list_pages( $args );
|
wp_list_pages( $args );
|
||||||
}
|
}
|
||||||
@ -281,7 +282,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
$expected = '<li class="pagenav">Pages<ul><li class="page_item page-item-' . self::$parent_3 . '"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a></li>
|
$expected = '<li class="pagenav">Pages<ul><li class="page_item page-item-' . self::$parent_3 . '"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a></li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_list_pages_number() {
|
function test_wp_list_pages_number() {
|
||||||
@ -293,7 +294,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
$expected = '<li class="pagenav">Pages<ul><li class="page_item page-item-' . self::$children[ self::$parent_1 ][0] . '"><a href="' . get_permalink( self::$children[ self::$parent_1 ][0] ) . '">Child 1</a></li>
|
$expected = '<li class="pagenav">Pages<ul><li class="page_item page-item-' . self::$children[ self::$parent_1 ][0] . '"><a href="' . get_permalink( self::$children[ self::$parent_1 ][0] ) . '">Child 1</a></li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_list_pages_sort_column() {
|
function test_wp_list_pages_sort_column() {
|
||||||
@ -326,7 +327,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
</li>
|
</li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_list_pages_link_before() {
|
function test_wp_list_pages_link_before() {
|
||||||
@ -358,7 +359,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
</li>
|
</li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_list_pages_link_after() {
|
function test_wp_list_pages_link_after() {
|
||||||
@ -390,7 +391,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
</li>
|
</li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -404,7 +405,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
<li class="page_item page-item-' . self::$parent_3 . '"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a></li>
|
<li class="page_item page-item-' . self::$parent_3 . '"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a></li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_list_pages_exclude_tree() {
|
function test_wp_list_pages_exclude_tree() {
|
||||||
@ -422,7 +423,7 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
</li>
|
</li>
|
||||||
</ul></li>';
|
</ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_wp_list_pages_discarded_whitespace() {
|
function test_wp_list_pages_discarded_whitespace() {
|
||||||
@ -433,6 +434,6 @@ class Tests_List_Pages extends WP_UnitTestCase {
|
|||||||
|
|
||||||
$expected = '<li class="pagenav">Pages<ul><li class="page_item page-item-' . self::$parent_1 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_1 ) . '">Parent 1</a><ul class=\'children\'><li class="page_item page-item-' . self::$children[ self::$parent_1 ][0] . '"><a href="' . get_permalink( self::$children[ self::$parent_1 ][0] ) . '">Child 1</a></li><li class="page_item page-item-' . self::$children[ self::$parent_1 ][1] . '"><a href="' . get_permalink( self::$children[ self::$parent_1 ][1] ) . '">Child 2</a></li><li class="page_item page-item-' . self::$children[ self::$parent_1 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_1 ][2] ) . '">Child 3</a></li></ul></li><li class="page_item page-item-' . self::$parent_2 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_2 ) . '">Parent 2</a><ul class=\'children\'><li class="page_item page-item-' . self::$children[ self::$parent_2 ][0] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][0] ) . '">Child 1</a></li><li class="page_item page-item-' . self::$children[ self::$parent_2 ][1] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][1] ) . '">Child 2</a></li><li class="page_item page-item-' . self::$children[ self::$parent_2 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][2] ) . '">Child 3</a></li></ul></li><li class="page_item page-item-' . self::$parent_3 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a><ul class=\'children\'><li class="page_item page-item-' . self::$children[ self::$parent_3 ][0] . '"><a href="' . get_permalink( self::$children[ self::$parent_3 ][0] ) . '">Child 1</a></li><li class="page_item page-item-' . self::$children[ self::$parent_3 ][1] . '"><a href="' . get_permalink( self::$children[ self::$parent_3 ][1] ) . '">Child 2</a></li><li class="page_item page-item-' . self::$children[ self::$parent_3 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_3 ][2] ) . '">Child 3</a></li></ul></li></ul></li>';
|
$expected = '<li class="pagenav">Pages<ul><li class="page_item page-item-' . self::$parent_1 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_1 ) . '">Parent 1</a><ul class=\'children\'><li class="page_item page-item-' . self::$children[ self::$parent_1 ][0] . '"><a href="' . get_permalink( self::$children[ self::$parent_1 ][0] ) . '">Child 1</a></li><li class="page_item page-item-' . self::$children[ self::$parent_1 ][1] . '"><a href="' . get_permalink( self::$children[ self::$parent_1 ][1] ) . '">Child 2</a></li><li class="page_item page-item-' . self::$children[ self::$parent_1 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_1 ][2] ) . '">Child 3</a></li></ul></li><li class="page_item page-item-' . self::$parent_2 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_2 ) . '">Parent 2</a><ul class=\'children\'><li class="page_item page-item-' . self::$children[ self::$parent_2 ][0] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][0] ) . '">Child 1</a></li><li class="page_item page-item-' . self::$children[ self::$parent_2 ][1] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][1] ) . '">Child 2</a></li><li class="page_item page-item-' . self::$children[ self::$parent_2 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][2] ) . '">Child 3</a></li></ul></li><li class="page_item page-item-' . self::$parent_3 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a><ul class=\'children\'><li class="page_item page-item-' . self::$children[ self::$parent_3 ][0] . '"><a href="' . get_permalink( self::$children[ self::$parent_3 ][0] ) . '">Child 1</a></li><li class="page_item page-item-' . self::$children[ self::$parent_3 ][1] . '"><a href="' . get_permalink( self::$children[ self::$parent_3 ][1] ) . '">Child 2</a></li><li class="page_item page-item-' . self::$children[ self::$parent_3 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_3 ][2] ) . '">Child 3</a></li></ul></li></ul></li>';
|
||||||
|
|
||||||
$this->AssertEquals( $expected, wp_list_pages( $args ) );
|
$this->assertEquals( $expected, wp_list_pages( $args ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ class Tests_Post_Template extends WP_UnitTestCase {
|
|||||||
LINEAGE;
|
LINEAGE;
|
||||||
|
|
||||||
$output = wp_dropdown_pages( array( 'echo' => 0 ) );
|
$output = wp_dropdown_pages( array( 'echo' => 0 ) );
|
||||||
$this->assertEquals( $lineage, $output );
|
$this->assertEqualsIgnoreEOL( $lineage, $output );
|
||||||
|
|
||||||
$depth = <<<DEPTH
|
$depth = <<<DEPTH
|
||||||
<select name='page_id' id='page_id'>
|
<select name='page_id' id='page_id'>
|
||||||
@ -179,7 +179,7 @@ DEPTH;
|
|||||||
'depth' => 1,
|
'depth' => 1,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals( $depth, $output );
|
$this->assertEqualsIgnoreEOL( $depth, $output );
|
||||||
|
|
||||||
$option_none = <<<NONE
|
$option_none = <<<NONE
|
||||||
<select name='page_id' id='page_id'>
|
<select name='page_id' id='page_id'>
|
||||||
@ -197,7 +197,7 @@ NONE;
|
|||||||
'option_none_value' => 'Woo',
|
'option_none_value' => 'Woo',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals( $option_none, $output );
|
$this->assertEqualsIgnoreEOL( $option_none, $output );
|
||||||
|
|
||||||
$option_no_change = <<<NO
|
$option_no_change = <<<NO
|
||||||
<select name='page_id' id='page_id'>
|
<select name='page_id' id='page_id'>
|
||||||
@ -207,7 +207,8 @@ NONE;
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
NO;
|
NO;
|
||||||
$output = wp_dropdown_pages(
|
|
||||||
|
$output = wp_dropdown_pages(
|
||||||
array(
|
array(
|
||||||
'echo' => 0,
|
'echo' => 0,
|
||||||
'depth' => 1,
|
'depth' => 1,
|
||||||
@ -216,7 +217,7 @@ NO;
|
|||||||
'show_option_no_change' => 'Burrito',
|
'show_option_no_change' => 'Burrito',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->assertEquals( $option_no_change, $output );
|
$this->assertEqualsIgnoreEOL( $option_no_change, $output );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user