Use the value of WP_TESTS_DOMAIN in some unit tests.

props danielhuesken.
fixes #28552.

git-svn-id: https://develop.svn.wordpress.org/trunk@28757 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2014-06-16 15:07:37 +00:00
parent 87f306aa81
commit 106e1dbedb
2 changed files with 13 additions and 11 deletions

View File

@ -33,12 +33,14 @@ class Tests_Get_Archives extends WP_UnitTestCase {
$ids = array_slice( array_reverse( $this->post_ids ), 0, 5 );
$expected['limit'] = <<<EOF
<li><a href='http://example.org/?p={$ids[0]}'>Post title 8</a></li>
<li><a href='http://example.org/?p={$ids[1]}'>Post title 7</a></li>
<li><a href='http://example.org/?p={$ids[2]}'>Post title 6</a></li>
<li><a href='http://example.org/?p={$ids[3]}'>Post title 5</a></li>
<li><a href='http://example.org/?p={$ids[4]}'>Post title 4</a></li>
<li><a href='http://{WP_TESTS_DOMAIN}/?p={$ids[0]}'>Post title 8</a></li>
<li><a href='http://{WP_TESTS_DOMAIN}/?p={$ids[1]}'>Post title 7</a></li>
<li><a href='http://{WP_TESTS_DOMAIN}/?p={$ids[2]}'>Post title 6</a></li>
<li><a href='http://{WP_TESTS_DOMAIN}/?p={$ids[3]}'>Post title 5</a></li>
<li><a href='http://{WP_TESTS_DOMAIN}/?p={$ids[4]}'>Post title 4</a></li>
EOF;
$expected['limit'] = str_replace( '{WP_TESTS_DOMAIN}', WP_TESTS_DOMAIN, $expected['limit'] );
$this->assertEquals( $expected['limit'], trim( wp_get_archives( array( 'echo' => false, 'type' => 'postbypost', 'limit' => 5 ) ) ) );
}

View File

@ -83,20 +83,20 @@ class Tests_User_ListAuthors extends WP_UnitTestCase {
}
function test_wp_list_authors_feed() {
$expected['feed'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> (<a href="http://example.org/?feed=rss2&amp;author=' . $this->users[1] . '">link to feed</a>)</li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> (<a href="http://example.org/?feed=rss2&amp;author=' . $this->users[2] . '">link to feed</a>)</li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> (<a href="http://example.org/?feed=rss2&amp;author=' . $this->users[0] . '">link to feed</a>)</li>';
$expected['feed'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&amp;author=' . $this->users[1] . '">link to feed</a>)</li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&amp;author=' . $this->users[2] . '">link to feed</a>)</li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&amp;author=' . $this->users[0] . '">link to feed</a>)</li>';
$this->AssertEquals( $expected['feed'], wp_list_authors( array( 'echo' => false, 'feed' => 'link to feed' ) ) );
}
function test_wp_list_authors_feed_image() {
$expected['feed_image'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> <a href="http://example.org/?feed=rss2&amp;author=' . $this->users[1] . '"><img src="http://example.com/path/to/a/graphic.png" style="border: none;" /></a></li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> <a href="http://example.org/?feed=rss2&amp;author=' . $this->users[2] . '"><img src="http://example.com/path/to/a/graphic.png" style="border: none;" /></a></li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> <a href="http://example.org/?feed=rss2&amp;author=' . $this->users[0] . '"><img src="http://example.com/path/to/a/graphic.png" style="border: none;" /></a></li>';
$this->AssertEquals( $expected['feed_image'], wp_list_authors( array( 'echo' => false, 'feed_image' => 'example.com/path/to/a/graphic.png' ) ) );
$expected['feed_image'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> <a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&amp;author=' . $this->users[1] . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> <a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&amp;author=' . $this->users[2] . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> <a href="http://' . WP_TESTS_DOMAIN . '/?feed=rss2&amp;author=' . $this->users[0] . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li>';
$this->AssertEquals( $expected['feed_image'], wp_list_authors( array( 'echo' => false, 'feed_image' => WP_TESTS_DOMAIN . '/path/to/a/graphic.png' ) ) );
}
/**
* @ticket 26538
*/
function test_wp_list_authors_feed_type() {
$expected['feed_type'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> (<a href="http://example.org/?feed=atom&amp;author=' . $this->users[1] . '">link to feed</a>)</li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> (<a href="http://example.org/?feed=atom&amp;author=' . $this->users[2] . '">link to feed</a>)</li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> (<a href="http://example.org/?feed=atom&amp;author=' . $this->users[0] . '">link to feed</a>)</li>';
$expected['feed_type'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&amp;author=' . $this->users[1] . '">link to feed</a>)</li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&amp;author=' . $this->users[2] . '">link to feed</a>)</li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> (<a href="http://' . WP_TESTS_DOMAIN . '/?feed=atom&amp;author=' . $this->users[0] . '">link to feed</a>)</li>';
$this->AssertEquals( $expected['feed_type'], wp_list_authors( array( 'echo' => false, 'feed' => 'link to feed', 'feed_type' => 'atom' ) ) );
}