diff --git a/tests/phpunit/tests/rest-api/rest-plugins-controller.php b/tests/phpunit/tests/rest-api/rest-plugins-controller.php index 3cea054301..fee1aa0494 100644 --- a/tests/phpunit/tests/rest-api/rest-plugins-controller.php +++ b/tests/phpunit/tests/rest-api/rest-plugins-controller.php @@ -86,10 +86,15 @@ class WP_REST_Plugins_Controller_Test extends WP_Test_REST_Controller_Testcase { if ( file_exists( WP_PLUGIN_DIR . '/test-plugin/test-plugin.php' ) ) { $this->rmdir( WP_PLUGIN_DIR . '/test-plugin' ); } + if ( file_exists( DIR_TESTDATA . '/link-manager.zip' ) ) { unlink( DIR_TESTDATA . '/link-manager.zip' ); } + if ( file_exists( WP_PLUGIN_DIR . '/link-manager/link-manager.php' ) ) { + $this->rmdir( WP_PLUGIN_DIR . '/link-manager' ); + } + parent::tear_down(); } @@ -369,10 +374,6 @@ class WP_REST_Plugins_Controller_Test extends WP_Test_REST_Controller_Testcase { * @ticket 50321 */ public function test_create_item() { - if ( isset( get_plugins()['link-manager/link-manager.php'] ) ) { - delete_plugins( array( 'link-manager/link-manager.php' ) ); - } - wp_set_current_user( self::$super_admin ); $this->setup_plugin_download(); @@ -389,10 +390,6 @@ class WP_REST_Plugins_Controller_Test extends WP_Test_REST_Controller_Testcase { * @ticket 50321 */ public function test_create_item_and_activate() { - if ( isset( get_plugins()['link-manager/link-manager.php'] ) ) { - delete_plugins( array( 'link-manager/link-manager.php' ) ); - } - wp_set_current_user( self::$super_admin ); $this->setup_plugin_download(); @@ -415,10 +412,6 @@ class WP_REST_Plugins_Controller_Test extends WP_Test_REST_Controller_Testcase { * @ticket 50321 */ public function test_create_item_and_activate_errors_if_no_permission_to_activate_plugin() { - if ( isset( get_plugins()['link-manager/link-manager.php'] ) ) { - delete_plugins( array( 'link-manager/link-manager.php' ) ); - } - wp_set_current_user( self::$super_admin ); $this->setup_plugin_download(); $this->disable_activate_permission( 'link-manager/link-manager.php' ); @@ -441,10 +434,6 @@ class WP_REST_Plugins_Controller_Test extends WP_Test_REST_Controller_Testcase { * @ticket 50321 */ public function test_create_item_and_network_activate_rejected_if_not_multisite() { - if ( isset( get_plugins()['link-manager/link-manager.php'] ) ) { - delete_plugins( array( 'link-manager/link-manager.php' ) ); - } - wp_set_current_user( self::$super_admin ); $this->setup_plugin_download(); @@ -465,10 +454,6 @@ class WP_REST_Plugins_Controller_Test extends WP_Test_REST_Controller_Testcase { * @ticket 50321 */ public function test_create_item_and_network_activate() { - if ( isset( get_plugins()['link-manager/link-manager.php'] ) ) { - delete_plugins( array( 'link-manager/link-manager.php' ) ); - } - wp_set_current_user( self::$super_admin ); $this->setup_plugin_download();