Skip to content
Snippets Groups Projects

v0.6

Merged Erick Hitter requested to merge fix/phpcs into master
Files
2
+ 4
27
@@ -26,7 +26,7 @@ class PluginTest extends WP_UnitTestCase {
/**
* Create a post to test with.
*/
public function setUp(): void {
public function setUp() {
parent::setUp();
static::$post_id_published = $this->factory->post->create();
@@ -40,7 +40,7 @@ class PluginTest extends WP_UnitTestCase {
/**
* Test shortlink overrides.
*/
public function test_shortlink_filters(): void {
public function test_shortlink_filters() {
$expected_published = user_trailingslashit( home_url( 'p/' . static::$post_id_published ) );
$expected_draft = add_query_arg( 'p', static::$post_id_draft, user_trailingslashit( home_url() ) );
@@ -51,7 +51,7 @@ class PluginTest extends WP_UnitTestCase {
/**
* Test redirect parsing for supported post.
*/
public function test_published_post_redirect(): void {
public function test_published_post_redirect() {
$fake_request = new \stdClass();
$fake_request->query_vars = [
'p' => static::$post_id_published,
@@ -67,7 +67,7 @@ class PluginTest extends WP_UnitTestCase {
/**
* Test redirect parsing for unsupported post.
*/
public function test_draft_post_redirect(): void {
public function test_draft_post_redirect() {
$fake_request = new \stdClass();
$fake_request->query_vars = [
'p' => static::$post_id_draft,
@@ -78,27 +78,4 @@ class PluginTest extends WP_UnitTestCase {
$this->assertNull( $redirect, 'Failed to assert that redirect is not generated for unsupported post status.' );
}
/**
* Indirect test of redirection.
*/
public function test_published_post_redirect_through_artifacts(): void {
add_filter( 'eth_simple_shortlinks_verify_requested_post_support', function( $verify ) {
$this->assertEquals( static::$post_id_published, get_query_var( 'p' ), 'Failed to assert that requested post ID matches ID of published post.' );
return $verify;
} );
add_filter( 'eth_simple_shortlinks_redirect_url', function( $url ) {
$this->assertEquals( get_permalink( static::$post_id_published ), $url, 'Failed to assert that redirect URL is published post\'s permalink.' );
return $url;
} );
$this->go_to( wp_get_shortlink( static::$post_id_published ) );
$this->assertQueryTrue(
'is_404'
);
}
}
Loading