Build/Test Tools: Utilise `assertFileExists()` and `assertFileNotExists()` in more places.
See #38716 git-svn-id: https://develop.svn.wordpress.org/trunk@39173 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
52a834a6d8
commit
5ab2a22a38
|
@ -29,6 +29,6 @@ class Tests_Admin_IncludesUpdateCore extends WP_UnitTestCase {
|
|||
* @param string $file File name.
|
||||
*/
|
||||
public function test_new_files_are_not_in_old_files_array_compiled( $file ) {
|
||||
$this->assertFalse( file_exists( dirname( ABSPATH ) . '/build/' . $file ) );
|
||||
$this->assertFileNotExists( dirname( ABSPATH ) . '/build/' . $file );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ class Tests_Ajax_MediaEdit extends WP_Ajax_UnitTestCase {
|
|||
}
|
||||
|
||||
foreach ( $files_that_shouldnt_exist as $file ) {
|
||||
$this->assertFalse( file_exists( $file ), 'IMAGE_EDIT_OVERWRITE is leaving garbage image files behind.' );
|
||||
$this->assertFileNotExists( $file, 'IMAGE_EDIT_OVERWRITE is leaving garbage image files behind.' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class Tests_Dependencies_Backbonejs extends WP_UnitTestCase {
|
|||
|
||||
function test_exclusion_of_sourcemaps() {
|
||||
$file = ABSPATH . WPINC . '/js/backbone.min.js';
|
||||
$this->assertTrue( file_exists( $file ) );
|
||||
$this->assertFileExists( $file );
|
||||
$contents = trim( file_get_contents( $file ) );
|
||||
$this->assertFalse( strpos( $contents, 'sourceMappingURL' ), 'Presence of sourceMappingURL' );
|
||||
}
|
||||
|
|
|
@ -76,14 +76,14 @@ class Tests_Multisite_MS_Files_Rewriting extends WP_UnitTestCase {
|
|||
wpmu_delete_blog( $blog_id, true );
|
||||
|
||||
// The file on the main site should still exist. The file on the deleted site should not.
|
||||
$this->assertTrue( file_exists( $file1['file'] ) );
|
||||
$this->assertFalse( file_exists( $file2['file'] ) );
|
||||
$this->assertFileExists( $file1['file'] );
|
||||
$this->assertFileNotExists( $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->assertTrue( file_exists( $file1['file'] ) );
|
||||
$this->assertFalse( file_exists( $file2['file'] ) );
|
||||
$this->assertFileExists( $file1['file'] );
|
||||
$this->assertFileNotExists( $file2['file'] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -285,14 +285,14 @@ class Tests_Multisite_Site extends WP_UnitTestCase {
|
|||
wpmu_delete_blog( $blog_id, true );
|
||||
|
||||
// The file on the main site should still exist. The file on the deleted site should not.
|
||||
$this->assertTrue( file_exists( $file1['file'] ) );
|
||||
$this->assertFalse( file_exists( $file2['file'] ) );
|
||||
$this->assertFileExists( $file1['file'] );
|
||||
$this->assertFileNotExists( $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->assertTrue( file_exists( $file1['file'] ) );
|
||||
$this->assertFalse( file_exists( $file2['file'] ) );
|
||||
$this->assertFileExists( $file1['file'] );
|
||||
$this->assertFileNotExists( $file2['file'] );
|
||||
}
|
||||
|
||||
function test_wpmu_update_blogs_date() {
|
||||
|
|
|
@ -210,7 +210,7 @@ class Tests_Theme extends WP_UnitTestCase {
|
|||
$wp_theme = wp_get_theme( $this->theme_slug );
|
||||
$this->assertNotEmpty( $wp_theme->get('License') );
|
||||
$path_to_style_css = $wp_theme->get_theme_root() . '/' . $wp_theme->get_stylesheet() . '/style.css';
|
||||
$this->assertTrue( file_exists( $path_to_style_css ) );
|
||||
$this->assertFileExists( $path_to_style_css );
|
||||
$theme_data = get_theme_data( $path_to_style_css );
|
||||
$this->assertArrayHasKey( 'License', $theme_data );
|
||||
$this->assertArrayNotHasKey( 'Not a Valid Key', $theme_data );
|
||||
|
|
|
@ -246,8 +246,8 @@ class Tests_Theme_ThemeDir extends WP_UnitTestCase {
|
|||
@mkdir( WP_CONTENT_DIR . '/themes/foo' );
|
||||
@mkdir( WP_CONTENT_DIR . '/themes/foo-themes' );
|
||||
|
||||
$this->assertTrue( file_exists( WP_CONTENT_DIR . '/themes/foo' ) );
|
||||
$this->assertTrue( file_exists( WP_CONTENT_DIR . '/themes/foo-themes') );
|
||||
$this->assertFileExists( WP_CONTENT_DIR . '/themes/foo' );
|
||||
$this->assertFileExists( WP_CONTENT_DIR . '/themes/foo-themes' );
|
||||
|
||||
register_theme_directory( '/' );
|
||||
|
||||
|
|
Loading…
Reference in New Issue