Make WordPress Core

Changeset 54301

Timestamp:
09/25/2022 02:41:22 AM (22 months ago)
Author:
SergeyBiryukov
Message:

Tests: Delete Link Manager plugin after running REST API plugins controller tests.

After running the multisite PHPUnit test suite, the following files remained, contributing towards a dirty working copy:

tests/phpunit/data/plugins/link-manager/link-manager.php
tests/phpunit/data/plugins/link-manager/readme.txt

These files should be deleted after running the tests.

This commit ensures the link-manager plugin is deleted during test tear down, which was previously done at the beginning of some test methods, but not afterwards.

Follow-up to [48242], [54300].

Props ironprogrammer.
Fixes #56629.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-plugins-controller.php

    r52138 r54301  
    8787            $this->rmdir( WP_PLUGIN_DIR . '/test-plugin' );
    8888        }
     89
    8990        if ( file_exists( DIR_TESTDATA . '/link-manager.zip' ) ) {
    9091            unlink( DIR_TESTDATA . '/link-manager.zip' );
     92
     93
     94
     95
    9196        }
    9297
     
    370375     */
    371376    public function test_create_item() {
    372         if ( isset( get_plugins()['link-manager/link-manager.php'] ) ) {
    373             delete_plugins( array( 'link-manager/link-manager.php' ) );
    374         }
    375 
    376377        wp_set_current_user( self::$super_admin );
    377378        $this->setup_plugin_download();
     
    390391     */
    391392    public function test_create_item_and_activate() {
    392         if ( isset( get_plugins()['link-manager/link-manager.php'] ) ) {
    393             delete_plugins( array( 'link-manager/link-manager.php' ) );
    394         }
    395 
    396393        wp_set_current_user( self::$super_admin );
    397394        $this->setup_plugin_download();
     
    416413     */
    417414    public function test_create_item_and_activate_errors_if_no_permission_to_activate_plugin() {
    418         if ( isset( get_plugins()['link-manager/link-manager.php'] ) ) {
    419             delete_plugins( array( 'link-manager/link-manager.php' ) );
    420         }
    421 
    422415        wp_set_current_user( self::$super_admin );
    423416        $this->setup_plugin_download();
     
    442435     */
    443436    public function test_create_item_and_network_activate_rejected_if_not_multisite() {
    444         if ( isset( get_plugins()['link-manager/link-manager.php'] ) ) {
    445             delete_plugins( array( 'link-manager/link-manager.php' ) );
    446         }
    447 
    448437        wp_set_current_user( self::$super_admin );
    449438        $this->setup_plugin_download();
     
    466455     */
    467456    public function test_create_item_and_network_activate() {
    468         if ( isset( get_plugins()['link-manager/link-manager.php'] ) ) {
    469             delete_plugins( array( 'link-manager/link-manager.php' ) );
    470         }
    471 
    472457        wp_set_current_user( self::$super_admin );
    473458        $this->setup_plugin_download();
Note: See TracChangeset for help on using the changeset viewer.