Skip to content

Commit d09e36b

Browse files
committed
Refactor unit test
1 parent ed05eae commit d09e36b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

plugins/faustwp/tests/integration/ReplacementCallbacksTests.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ public function test_post_preview_link_adds_preview_true_query_param() {
186186
*/
187187
public function test_post_preview_doesnt_rewrite_link_with_redirect_off() {
188188
faustwp_update_setting( 'enable_redirects', false );
189+
$expected = 'http://moo/?p=' . $this->post_id;
190+
$link = post_preview_link( $expected, get_post( $this->post_id ) );
189191

190-
$link = post_preview_link( 'http://moo/', get_post( $this->post_id ) );
191-
192-
$this->assertSame( 'http://moo/', $link );
192+
$this->assertSame( $expected, $link );
193193

194194
faustwp_update_setting( 'enable_redirects', true );
195195
}
@@ -214,6 +214,7 @@ public function test_custom_post_type_post_preview_link_returns_filtered_link_wh
214214
{
215215
faustwp_update_setting( 'frontend_uri', 'http://moo' );
216216
faustwp_update_setting( 'enable_rewrites', true );
217+
faustwp_update_setting( 'enable_redirects', true );
217218
$post_id = $this->getCustomPostType();
218219
$this->assertSame( 'http://moo/?document=' . $post_id . '&preview=true&previewPathname=' . rawurlencode( wp_make_link_relative( get_permalink( $post_id ) ) ) . '&p=' . $post_id . '&typeName=Document', get_preview_post_link( $post_id ) );
219220
faustwp_update_setting( 'frontend_uri', null );
@@ -238,6 +239,7 @@ public function test_custom_post_type_post_link_returns_unfiltered_link_when_con
238239
*/
239240
public function test_post_preview_link_filters_link_for_posts_not_registered_with_wpgraphql() {
240241
faustwp_update_setting( 'frontend_uri', 'http://moo' );
242+
faustwp_update_setting( 'enable_redirects', true );
241243

242244
register_post_type('notgraphql', ['public' => true]);
243245

0 commit comments

Comments
 (0)