Changeset 47122 for trunk/tests/phpunit/tests/link/getAdjacentPost.php
- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/link/getAdjacentPost.php
r46586 r47122 11 11 */ 12 12 public function test_get_adjacent_post() { 13 // Need some sample posts to test adjacency 13 // Need some sample posts to test adjacency. 14 14 $post_one = self::factory()->post->create_and_get( 15 15 array( … … 40 40 ); 41 41 42 // Assign some terms 42 // Assign some terms. 43 43 wp_set_object_terms( $post_one->ID, 'WordPress', 'category', false ); 44 44 wp_set_object_terms( $post_three->ID, 'WordPress', 'category', false ); … … 47 47 wp_set_object_terms( $post_four->ID, 'plugins', 'post_tag', false ); 48 48 49 // Test normal post adjacency 49 // Test normal post adjacency. 50 50 $this->go_to( get_permalink( $post_two->ID ) ); 51 51 … … 56 56 $this->assertNotEquals( $post_two, get_adjacent_post( false, '', false ) ); 57 57 58 // Test category adjacency 58 // Test category adjacency. 59 59 $this->go_to( get_permalink( $post_one->ID ) ); 60 60 … … 62 62 $this->assertEquals( $post_three, get_adjacent_post( true, '', false, 'category' ) ); 63 63 64 // Test tag adjacency 64 // Test tag adjacency. 65 65 $this->go_to( get_permalink( $post_two->ID ) ); 66 66 … … 68 68 $this->assertEquals( $post_four, get_adjacent_post( true, '', false, 'post_tag' ) ); 69 69 70 // Test normal boundary post 70 // Test normal boundary post. 71 71 $this->go_to( get_permalink( $post_two->ID ) ); 72 72 … … 74 74 $this->assertEquals( array( $post_four ), get_boundary_post( false, '', false ) ); 75 75 76 // Test category boundary post 76 // Test category boundary post. 77 77 $this->go_to( get_permalink( $post_one->ID ) ); 78 78 … … 80 80 $this->assertEquals( array( $post_three ), get_boundary_post( true, '', false, 'category' ) ); 81 81 82 // Test tag boundary post 82 // Test tag boundary post. 83 83 $this->go_to( get_permalink( $post_two->ID ) ); 84 84 … … 145 145 ); 146 146 147 // First post 147 // First post. 148 148 $this->go_to( get_permalink( $one ) ); 149 149 $this->assertEquals( $two, get_adjacent_post( false, array(), false ) ); … … 153 153 $this->assertEmpty( get_adjacent_post( false, array(), true ) ); 154 154 155 // Fourth post 155 // Fourth post. 156 156 $this->go_to( get_permalink( $four ) ); 157 157 $this->assertEquals( $five, get_adjacent_post( false, array(), false ) ); … … 165 165 $this->assertEmpty( get_adjacent_post( true, array( $exclude ), true ) ); 166 166 167 // Last post 167 // Last post. 168 168 $this->go_to( get_permalink( $five ) ); 169 169 $this->assertEquals( $four, get_adjacent_post( false, array(), true ) );
Note: See TracChangeset
for help on using the changeset viewer.