mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-05-25 21:54:28 +00:00
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: * https://github.com/sebastianbergmann/phpunit/blob/9.1.5/ChangeLog-9.1.md#910---2020-04-03 * https://github.com/sebastianbergmann/phpunit/issues/4076 Follow-up to [51559-51563]. Props jrf. See #46149. git-svn-id: https://develop.svn.wordpress.org/trunk@51564 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -403,7 +403,7 @@ class Tests_Admin_includesPlugin extends WP_UnitTestCase {
|
||||
* @covers ::get_mu_plugins
|
||||
*/
|
||||
public function test_get_mu_plugins_when_mu_plugins_directory_does_not_exist() {
|
||||
$this->assertFileNotExists( WPMU_PLUGIN_DIR );
|
||||
$this->assertFileDoesNotExist( WPMU_PLUGIN_DIR );
|
||||
$this->assertSame( array(), get_mu_plugins() );
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ class Tests_Ajax_MediaEdit extends WP_Ajax_UnitTestCase {
|
||||
}
|
||||
|
||||
foreach ( $files_that_shouldnt_exist as $file ) {
|
||||
$this->assertFileNotExists( $file, 'IMAGE_EDIT_OVERWRITE is leaving garbage image files behind.' );
|
||||
$this->assertFileDoesNotExist( $file, 'IMAGE_EDIT_OVERWRITE is leaving garbage image files behind.' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
// Check number is appended for file already exists.
|
||||
$this->assertFileExists( $testdir . 'test-image.png', 'Test image does not exist' );
|
||||
$this->assertSame( 'test-image-1.png', wp_unique_filename( $testdir, 'test-image.png' ), 'Number not appended correctly' );
|
||||
$this->assertFileNotExists( $testdir . 'test-image-1.png' );
|
||||
$this->assertFileDoesNotExist( $testdir . 'test-image-1.png' );
|
||||
|
||||
// Check special chars.
|
||||
$this->assertSame( 'testtest-image.png', wp_unique_filename( $testdir, 'testtést-imagé.png' ), 'Filename with special chars failed' );
|
||||
|
||||
@@ -607,7 +607,7 @@ class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
|
||||
$directory = realpath( DIR_TESTDATA ) . '/images/nonexistent-directory';
|
||||
$editor = new WP_Image_Editor_Imagick( $file );
|
||||
|
||||
$this->assertFileNotExists( $directory );
|
||||
$this->assertFileDoesNotExist( $directory );
|
||||
|
||||
$loaded = $editor->load();
|
||||
$this->assertNotWPError( $loaded );
|
||||
|
||||
@@ -121,13 +121,13 @@ class Tests_Link_ThemeFile extends WP_UnitTestCase {
|
||||
if ( in_array( 'theme-file-child', $existence, true ) ) {
|
||||
$this->assertFileExists( WP_CONTENT_DIR . "/themes/theme-file-child/{$file}" );
|
||||
} else {
|
||||
$this->assertFileNotExists( WP_CONTENT_DIR . "/themes/theme-file-child/{$file}" );
|
||||
$this->assertFileDoesNotExist( WP_CONTENT_DIR . "/themes/theme-file-child/{$file}" );
|
||||
}
|
||||
|
||||
if ( in_array( 'theme-file-parent', $existence, true ) ) {
|
||||
$this->assertFileExists( WP_CONTENT_DIR . "/themes/theme-file-parent/{$file}" );
|
||||
} else {
|
||||
$this->assertFileNotExists( WP_CONTENT_DIR . "/themes/theme-file-parent/{$file}" );
|
||||
$this->assertFileDoesNotExist( WP_CONTENT_DIR . "/themes/theme-file-parent/{$file}" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -76,13 +76,13 @@ if ( is_multisite() ) :
|
||||
|
||||
// The file on the main site should still exist. The file on the deleted site should not.
|
||||
$this->assertFileExists( $file1['file'] );
|
||||
$this->assertFileNotExists( $file2['file'] );
|
||||
$this->assertFileDoesNotExist( $file2['file'] );
|
||||
|
||||
wpmu_delete_blog( $blog_id, true );
|
||||
|
||||
// The file on the main site should still exist. The file on the deleted site should not.
|
||||
$this->assertFileExists( $file1['file'] );
|
||||
$this->assertFileNotExists( $file2['file'] );
|
||||
$this->assertFileDoesNotExist( $file2['file'] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -391,13 +391,13 @@ if ( is_multisite() ) :
|
||||
|
||||
// The file on the main site should still exist. The file on the deleted site should not.
|
||||
$this->assertFileExists( $file1['file'] );
|
||||
$this->assertFileNotExists( $file2['file'] );
|
||||
$this->assertFileDoesNotExist( $file2['file'] );
|
||||
|
||||
wpmu_delete_blog( $blog_id, true );
|
||||
|
||||
// The file on the main site should still exist. The file on the deleted site should not.
|
||||
$this->assertFileExists( $file1['file'] );
|
||||
$this->assertFileNotExists( $file2['file'] );
|
||||
$this->assertFileDoesNotExist( $file2['file'] );
|
||||
}
|
||||
|
||||
function test_wpmu_update_blogs_date() {
|
||||
|
||||
@@ -844,7 +844,7 @@ class WP_REST_Plugins_Controller_Test extends WP_Test_REST_Controller_Testcase {
|
||||
$this->assertSame( 200, $response->get_status() );
|
||||
$this->assertTrue( $response->get_data()['deleted'] );
|
||||
$this->assertSame( self::PLUGIN, $response->get_data()['previous']['plugin'] );
|
||||
$this->assertFileNotExists( WP_PLUGIN_DIR . '/' . self::PLUGIN_FILE );
|
||||
$this->assertFileDoesNotExist( WP_PLUGIN_DIR . '/' . self::PLUGIN_FILE );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user