Skip to content

Commit

Permalink
Update ReplacementCallbacksTests.php
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewguywright committed Nov 13, 2023
1 parent ed05eae commit 819e8aa
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function test_post_link_returns_filtered_link_when_content_replacement_is
*/
public function test_post_preview_link_returns_filtered_link() {
faustwp_update_setting( 'frontend_uri', 'http://moo' );
faustwp_update_setting( 'enable_redirects', true );

$this->assertSame( 'http://moo/?p=' . $this->post_id . '&preview=true&previewPathname=' . rawurlencode( wp_make_link_relative( get_permalink( $this->post_id ) ) ) . '&typeName=Post', get_preview_post_link( $this->post_id ) );
}

Expand All @@ -175,7 +175,7 @@ public function test_post_preview_link_returns_filtered_link() {
*/
public function test_post_preview_link_adds_preview_true_query_param() {
faustwp_update_setting( 'frontend_uri', 'http://moo' );
faustwp_update_setting( 'enable_redirects', true );

$link = post_preview_link( 'http://moo/', get_post( $this->post_id ) );

$this->assertSame( 'http://moo/?previewPathname=' . rawurlencode( wp_make_link_relative( get_permalink( $this->post_id ) ) ) . '&p=' . $this->post_id . '&preview=true&typeName=Post', $link );
Expand All @@ -190,15 +190,13 @@ public function test_post_preview_doesnt_rewrite_link_with_redirect_off() {
$link = post_preview_link( 'http://moo/', get_post( $this->post_id ) );

$this->assertSame( 'http://moo/', $link );

faustwp_update_setting( 'enable_redirects', true );
}

/**
* Tests post_preview_link() uses frontend_uri scheme if different than home_url scheme.
*/
public function test_post_preview_link_uses_frontend_uri_scheme() {
faustwp_update_setting( 'enable_redirects', true );

faustwp_update_setting( 'frontend_uri', 'http://moo' );
add_filter( 'home_url', [$this, 'get_home_url'] );
$link = post_preview_link( 'http://moo/', get_post( $this->post_id ) );
Expand Down

0 comments on commit 819e8aa

Please sign in to comment.