From dfcf36d105b27f42b23c1ee50c8eed9d0a98f9ec Mon Sep 17 00:00:00 2001 From: costdev Date: Sun, 9 Jun 2024 02:37:36 +0100 Subject: [PATCH] Improve assertion accuracy for what is being tested. --- .../tests/admin/includes/wpGetPluginActionButton.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/admin/includes/wpGetPluginActionButton.php b/tests/phpunit/tests/admin/includes/wpGetPluginActionButton.php index 500549f64c232..80be6159a9c70 100644 --- a/tests/phpunit/tests/admin/includes/wpGetPluginActionButton.php +++ b/tests/phpunit/tests/admin/includes/wpGetPluginActionButton.php @@ -84,7 +84,8 @@ public function test_should_return_empty_string_without_proper_capabilities() { true ); - $this->assertSame( '', $actual, 'No button markup should be returned.' ); + $this->assertIsString( $actual, 'A string should be returned.' ); + $this->assertSame( '', $actual, 'An empty string should be returned.' ); } /** @@ -113,7 +114,8 @@ public function test_should_not_return_empty_string_with_proper_capabilities_sin self::$role->remove_cap( $capability ); - $this->assertNotSame( '', $actual, 'Button markup should be returned.' ); + $this->assertIsString( $actual, 'A string should be returned.' ); + $this->assertNotSame( '', $actual, 'An empty string should not be returned.' ); } /** @@ -147,6 +149,7 @@ public function test_should_not_return_empty_string_with_proper_capabilities_mul revoke_super_admin( self::$user_id ); - $this->assertNotSame( '', $actual, 'Button markup should be returned.' ); + $this->assertIsString( $actual, 'A string should be returned.' ); + $this->assertNotSame( '', $actual, 'An empty string should not be returned.' ); } }