Make WordPress Core

Changeset 51564


Ignore:
Timestamp:
08/06/2021 09:45:32 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Replace assertFileNotExists() with assertFileDoesNotExist().

The assertFileNotExists() method was hard deprecated in PHPUnit 9.1 and the functionality will be removed in PHPUnit 10.0.

The assertFileDoesNotExist() method was introduced as a replacement in PHPUnit 9.1.

This new PHPUnit method is polyfilled by the PHPUnit Polyfills and switching to it will future-proof the tests some more.

References:

Follow-up to [51559-51563].

Props jrf.
See #46149.

Location:
trunk/tests/phpunit/tests
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/admin/includesPlugin.php

    r51419 r51564  
    404404     */
    405405    public function test_get_mu_plugins_when_mu_plugins_directory_does_not_exist() {
    406         $this->assertFileNotExists( WPMU_PLUGIN_DIR );
     406        $this->assertFileDoesNotExist( WPMU_PLUGIN_DIR );
    407407        $this->assertSame( array(), get_mu_plugins() );
    408408    }
  • trunk/tests/phpunit/tests/ajax/MediaEdit.php

    r51415 r51564  
    9797
    9898        foreach ( $files_that_shouldnt_exist as $file ) {
    99             $this->assertFileNotExists( $file, 'IMAGE_EDIT_OVERWRITE is leaving garbage image files behind.' );
     99            $this->assertFileDoesNotExist( $file, 'IMAGE_EDIT_OVERWRITE is leaving garbage image files behind.' );
    100100        }
    101101    }
  • trunk/tests/phpunit/tests/functions.php

    r51537 r51564  
    174174        $this->assertFileExists( $testdir . 'test-image.png', 'Test image does not exist' );
    175175        $this->assertSame( 'test-image-1.png', wp_unique_filename( $testdir, 'test-image.png' ), 'Number not appended correctly' );
    176         $this->assertFileNotExists( $testdir . 'test-image-1.png' );
     176        $this->assertFileDoesNotExist( $testdir . 'test-image-1.png' );
    177177
    178178        // Check special chars.
  • trunk/tests/phpunit/tests/image/editorImagick.php

    r50491 r51564  
    608608        $editor    = new WP_Image_Editor_Imagick( $file );
    609609
    610         $this->assertFileNotExists( $directory );
     610        $this->assertFileDoesNotExist( $directory );
    611611
    612612        $loaded = $editor->load();
  • trunk/tests/phpunit/tests/link/themeFile.php

    r50454 r51564  
    122122            $this->assertFileExists( WP_CONTENT_DIR . "/themes/theme-file-child/{$file}" );
    123123        } else {
    124             $this->assertFileNotExists( WP_CONTENT_DIR . "/themes/theme-file-child/{$file}" );
     124            $this->assertFileDoesNotExist( WP_CONTENT_DIR . "/themes/theme-file-child/{$file}" );
    125125        }
    126126
     
    128128            $this->assertFileExists( WP_CONTENT_DIR . "/themes/theme-file-parent/{$file}" );
    129129        } else {
    130             $this->assertFileNotExists( WP_CONTENT_DIR . "/themes/theme-file-parent/{$file}" );
     130            $this->assertFileDoesNotExist( WP_CONTENT_DIR . "/themes/theme-file-parent/{$file}" );
    131131        }
    132132
  • trunk/tests/phpunit/tests/multisite/ms-files-rewriting.php

    r50463 r51564  
    7777            // The file on the main site should still exist. The file on the deleted site should not.
    7878            $this->assertFileExists( $file1['file'] );
    79             $this->assertFileNotExists( $file2['file'] );
     79            $this->assertFileDoesNotExist( $file2['file'] );
    8080
    8181            wpmu_delete_blog( $blog_id, true );
     
    8383            // The file on the main site should still exist. The file on the deleted site should not.
    8484            $this->assertFileExists( $file1['file'] );
    85             $this->assertFileNotExists( $file2['file'] );
     85            $this->assertFileDoesNotExist( $file2['file'] );
    8686        }
    8787    }
  • trunk/tests/phpunit/tests/multisite/site.php

    r51462 r51564  
    392392            // The file on the main site should still exist. The file on the deleted site should not.
    393393            $this->assertFileExists( $file1['file'] );
    394             $this->assertFileNotExists( $file2['file'] );
     394            $this->assertFileDoesNotExist( $file2['file'] );
    395395
    396396            wpmu_delete_blog( $blog_id, true );
     
    398398            // The file on the main site should still exist. The file on the deleted site should not.
    399399            $this->assertFileExists( $file1['file'] );
    400             $this->assertFileNotExists( $file2['file'] );
     400            $this->assertFileDoesNotExist( $file2['file'] );
    401401        }
    402402
  • trunk/tests/phpunit/tests/rest-api/rest-plugins-controller.php

    r51563 r51564  
    845845        $this->assertTrue( $response->get_data()['deleted'] );
    846846        $this->assertSame( self::PLUGIN, $response->get_data()['previous']['plugin'] );
    847         $this->assertFileNotExists( WP_PLUGIN_DIR . '/' . self::PLUGIN_FILE );
     847        $this->assertFileDoesNotExist( WP_PLUGIN_DIR . '/' . self::PLUGIN_FILE );
    848848    }
    849849
Note: See TracChangeset for help on using the changeset viewer.