Make WordPress Core


Ignore:
Timestamp:
07/02/2014 07:44:08 PM (10 years ago)
Author:
wonderboymusic
Message:

URLs in unit tests need to be generated, not hard-coded.

See #28706.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions/getArchives.php

    r28757 r28960  
    3333        $ids = array_slice( array_reverse( $this->post_ids ), 0, 5 );
    3434
     35        $link1 = get_permalink( $ids[0] );
     36        $link2 = get_permalink( $ids[1] );
     37        $link3 = get_permalink( $ids[2] );
     38        $link4 = get_permalink( $ids[3] );
     39        $link5 = get_permalink( $ids[4] );
     40
    3541        $expected['limit'] = <<<EOF
    36 <li><a href='http://{WP_TESTS_DOMAIN}/?p={$ids[0]}'>Post title 8</a></li>
    37     <li><a href='http://{WP_TESTS_DOMAIN}/?p={$ids[1]}'>Post title 7</a></li>
    38     <li><a href='http://{WP_TESTS_DOMAIN}/?p={$ids[2]}'>Post title 6</a></li>
    39     <li><a href='http://{WP_TESTS_DOMAIN}/?p={$ids[3]}'>Post title 5</a></li>
    40     <li><a href='http://{WP_TESTS_DOMAIN}/?p={$ids[4]}'>Post title 4</a></li>
     42<li><a href='$link1'>Post title 8</a></li>
     43    <li><a href='$link2'>Post title 7</a></li>
     44    <li><a href='$link3'>Post title 6</a></li>
     45    <li><a href='$link4'>Post title 5</a></li>
     46    <li><a href='$link5'>Post title 4</a></li>
    4147EOF;
    42         $expected['limit'] = str_replace( '{WP_TESTS_DOMAIN}', WP_TESTS_DOMAIN, $expected['limit'] );
    43 
    4448        $this->assertEquals( $expected['limit'], trim( wp_get_archives( array( 'echo' => false, 'type' => 'postbypost', 'limit' => 5 ) ) ) );
    4549    }
Note: See TracChangeset for help on using the changeset viewer.