Make WordPress Core

Changeset 61212


Ignore:
Timestamp:
11/11/2025 01:31:30 PM (11 months ago)
Author:
SergeyBiryukov
Message:

Tests: Clean up file destination in _unzip_file_*() unit tests.

This ensures clean environment in case of a previous test failure.

Follow-up to [56689].

Props aslamdoctor, wildworks, peterwilsoncc, SirLouen, mindctrl, kalpeshh, yashjawale, sachinrajcp123, SergeyBiryukov.
Fixes #63443.

Location:
trunk/tests/phpunit/tests/filesystem
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/filesystem/unzipFilePclzip.php

    r56971 r61212  
    4242                // Prepare test environment.
    4343                $unzip_destination = self::$test_data_dir . 'archive/';
     44                if ( file_exists( $unzip_destination ) ) {
     45                        $this->rmdir( $unzip_destination );
     46                        $this->delete_folders( $unzip_destination );
     47                }
    4448                mkdir( $unzip_destination );
    4549
    4650                _unzip_file_pclzip( self::$test_data_dir . 'archive.zip', $unzip_destination );
    4751
    48                 // Cleanup test environment.
     52                // Clean up test environment.
    4953                $this->rmdir( $unzip_destination );
    5054                $this->delete_folders( $unzip_destination );
    … …  
    6468                // Prepare test environment.
    6569                $unzip_destination = self::$test_data_dir . 'archive/';
     70                if ( file_exists( $unzip_destination ) ) {
     71                        $this->rmdir( $unzip_destination );
     72                        $this->delete_folders( $unzip_destination );
     73                }
    6674                mkdir( $unzip_destination );
    6775
    6876                _unzip_file_pclzip( self::$test_data_dir . 'archive.zip', $unzip_destination );
    6977
    70                 // Cleanup test environment.
     78                // Clean up test environment.
    7179                $this->rmdir( $unzip_destination );
    7280                $this->delete_folders( $unzip_destination );
  • trunk/tests/phpunit/tests/filesystem/unzipFileZiparchive.php

    r56971 r61212  
    4646                // Prepare test environment.
    4747                $unzip_destination = self::$test_data_dir . 'archive/';
     48                if ( file_exists( $unzip_destination ) ) {
     49                        $this->rmdir( $unzip_destination );
     50                        $this->delete_folders( $unzip_destination );
     51                }
    4852                mkdir( $unzip_destination );
    4953
    5054                _unzip_file_ziparchive( self::$test_data_dir . 'archive.zip', $unzip_destination );
    5155
    52                 // Cleanup test environment.
     56                // Clean up test environment.
    5357                $this->rmdir( $unzip_destination );
    5458                $this->delete_folders( $unzip_destination );
    … …  
    7276                // Prepare test environment.
    7377                $unzip_destination = self::$test_data_dir . 'archive/';
     78                if ( file_exists( $unzip_destination ) ) {
     79                        $this->rmdir( $unzip_destination );
     80                        $this->delete_folders( $unzip_destination );
     81                }
    7482                mkdir( $unzip_destination );
    7583
    7684                _unzip_file_ziparchive( self::$test_data_dir . 'archive.zip', $unzip_destination );
    7785
    78                 // Cleanup test environment.
     86                // Clean up test environment.
    7987                $this->rmdir( $unzip_destination );
    8088                $this->delete_folders( $unzip_destination );
Note: See TracChangeset for help on using the changeset viewer.