Changeset 50132 for trunk/tests/phpunit/tests/media.php
- Timestamp:
- 02/02/2021 12:38:40 AM (5 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/media.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/media.php
r49974 r50132 3123 3123 * 3124 3124 * @param string $post_key Post as keyed in the shared fixture array. 3125 * @param string $expected Expected result.3125 * @param string $expected_url Expected permalink. 3126 3126 * @param bool $expected_404 Whether the page is expected to return a 404 result. 3127 3127 * 3128 3128 */ 3129 function test_attachment_permalinks_based_on_parent_status( $post_key, $expected , $expected_404 ) {3129 function test_attachment_permalinks_based_on_parent_status( $post_key, $expected_url, $expected_404 ) { 3130 3130 $this->set_permalink_structure( '/%postname%' ); 3131 3131 $post = get_post( self::$post_ids[ $post_key ] ); … … 3135 3135 * post object IDs are placeholders that needs to be replaced. 3136 3136 */ 3137 $expected = home_url( str_replace( '%ID%', $post->ID, $expected ) ); 3138 3139 $this->assertSame( $expected, get_permalink( $post ) ); 3137 $expected_url = home_url( str_replace( '%ID%', $post->ID, $expected_url ) ); 3138 3140 3139 $this->go_to( get_permalink( $post ) ); 3141 $this->assertSame( $expected_404, is_404() ); 3140 $this->assertSame( $expected_url, get_permalink( $post ) ); 3141 if ( $expected_404 ) { 3142 $this->assertQueryTrue( 'is_404' ); 3143 } else { 3144 $this->assertQueryTrue( 'is_attachment', 'is_single', 'is_singular' ); 3145 } 3146 $this->assertSame( 'attachment', $post->post_type ); 3142 3147 } 3143 3148 … … 3147 3152 * @return array[] { 3148 3153 * @type string $post_key Post as keyed in the shared fixture array. 3149 * @type string $expected Expected result.3154 * @type string $expected_url Expected permalink. 3150 3155 * $type bool $expected_404 Whether the page is expected to return a 404 result. 3151 3156 * }
Note: See TracChangeset
for help on using the changeset viewer.