| 97 | |
| 98 | /** |
| 99 | * @ticket 43689 |
| 100 | */ |
| 101 | public function test_get_next_post_link_same_term_custom_taxonomy_cpt() { |
| 102 | register_post_type( 'wp_tests_cpt_same_ct', array() ); |
| 103 | register_taxonomy( 'wp_tests_ct', array( 'wp_tests_cpt_same_ct' ) ); |
| 104 | |
| 105 | $p1 = $this->factory->post->create( array( |
| 106 | 'post_type' => 'wp_tests_cpt_same_ct', |
| 107 | 'post_date' => '2018-04-08 01:00:00', |
| 108 | 'post_status' => 'publish', |
| 109 | ) ); |
| 110 | |
| 111 | $p2 = $this->factory->post->create( array( |
| 112 | 'post_type' => 'wp_tests_cpt_same_ct', |
| 113 | 'post_date' => '2018-04-08 02:00:00', |
| 114 | 'post_status' => 'publish', |
| 115 | ) ); |
| 116 | |
| 117 | $p3 = $this->factory->post->create( array( |
| 118 | 'post_type' => 'wp_tests_cpt_same_ct', |
| 119 | 'post_date' => '2018-04-08 03:00:00', |
| 120 | 'post_status' => 'publish', |
| 121 | ) ); |
| 122 | |
| 123 | wp_set_object_terms( $p1, array( 'developer' ), 'wp_tests_ct' ); |
| 124 | wp_set_object_terms( $p2, array( 'designer' ), 'wp_tests_ct' ); |
| 125 | wp_set_object_terms( $p3, array( 'developer' ), 'wp_tests_ct' ); |
| 126 | |
| 127 | $GLOBALS['post'] = get_post( $p1 ); |
| 128 | |
| 129 | $actual = get_next_post_link( '« %link', '%title', true, array(), 'wp_tests_ct' ); |
| 130 | |
| 131 | $title = get_post( $p3 )->post_title; |
| 132 | $expected = '« <a href="' . get_permalink( $p3 ) . '" rel="next">' . $title . '</a>'; |
| 133 | $this->assertSame( $expected, $actual ); |
| 134 | } |