Make WordPress Core

Ticket #28026: unittest-updated.28026.diff

File unittest-updated.28026.diff, 1.2 KB (added by lektro, 10 years ago)

Updated unit test

  • tests/phpunit/tests/link.php

    diff --git tests/phpunit/tests/link.php tests/phpunit/tests/link.php
    index 1de3f68..13c6d11 100644
    class Tests_Link extends WP_UnitTestCase { 
    286286                $relative_link = wp_make_link_relative( $link );
    287287                $this->assertEquals( '/this-is-a-test/?redirect=https://example.org/a-different-test-post/', $relative_link );
    288288        }
     289
     290        /**
     291         * @ticket 28026
     292         */
     293        function test_same_date_posts_sort_by_id() {
     294                // Need some sample posts to test adjacency
     295                $post_one = $this->factory->post->create_and_get( array(
     296                        'post_title' => 'First',
     297                        'post_date' => '2012-01-01 12:00:00'
     298                ) );
     299
     300                $post_two = $this->factory->post->create_and_get( array(
     301                        'post_title' => 'Second',
     302                        'post_date' => '2012-02-01 12:00:00'
     303                ) );
     304
     305                $post_three = $this->factory->post->create_and_get( array(
     306                        'post_title' => 'Third',
     307                        'post_date' => '2012-02-01 12:00:00'
     308                ) );
     309
     310                // Test equal date post adjacency
     311                $this->go_to( get_permalink( $post_two->ID ) );
     312
     313                $this->assertEquals( $post_one, get_adjacent_post( false, '', true ) );
     314
     315                $this->go_to( get_permalink( $post_three->ID ) );
     316
     317                $this->assertEquals( $post_two, get_adjacent_post( false, '', true ) );
     318
     319        }
    289320}