URLs need to be generated, not hard-coded, in user/listAuthors.php test.

See #28706.


git-svn-id: https://develop.svn.wordpress.org/trunk@28968 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-07-03 02:13:08 +00:00
parent 26aa4e4e7f
commit 16aa589a07

View File

@ -83,12 +83,18 @@ 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://' . 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>';
$url0 = get_author_feed_link( $this->users[0] );
$url1 = get_author_feed_link( $this->users[1] );
$url2 = get_author_feed_link( $this->users[2] );
$expected['feed'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> (<a href="' . $url2 . '">link to feed</a>)</li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> (<a href="' . $url0 . '">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://' . 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>';
$url0 = get_author_feed_link( $this->users[0] );
$url1 = get_author_feed_link( $this->users[1] );
$url2 = get_author_feed_link( $this->users[2] );
$expected['feed_image'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> <a href="' . $url1 . '"><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="' . $url2 . '"><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="' . $url0 . '"><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' ) ) );
}
@ -96,7 +102,10 @@ class Tests_User_ListAuthors extends WP_UnitTestCase {
* @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://' . 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>';
$url0 = get_author_feed_link( $this->users[0], 'atom' );
$url1 = get_author_feed_link( $this->users[1], 'atom' );
$url2 = get_author_feed_link( $this->users[2], 'atom' );
$expected['feed_type'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> (<a href="' . $url2 . '">link to feed</a>)</li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> (<a href="' . $url0 . '">link to feed</a>)</li>';
$this->AssertEquals( $expected['feed_type'], wp_list_authors( array( 'echo' => false, 'feed' => 'link to feed', 'feed_type' => 'atom' ) ) );
}