From 213bbf76ed8320c0b7e72e58a7b641a8e89e1602 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 7 Aug 2021 14:15:42 +0000 Subject: [PATCH] Tests: Use more appropriate assertions in `get_themes()` tests. This replaces instances of `assertTrue( is_file( ... ) )` followed by `assertTrue( is_readable( ... ) )` with `assertFileIsReadable()` to use native PHPUnit functionality. The `assertFileIsReadable()` method was introduced in PHPUnit 5.6. As the minimum supported PHPUnit version has been raised to PHPUnit 5.7.21, it can now be used. Follow-up to [51543], [51574]. Props jrf. See #53363. git-svn-id: https://develop.svn.wordpress.org/trunk@51579 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/theme.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/phpunit/tests/theme.php b/tests/phpunit/tests/theme.php index 6e8ad62aee..d7e81db033 100644 --- a/tests/phpunit/tests/theme.php +++ b/tests/phpunit/tests/theme.php @@ -148,16 +148,14 @@ class Tests_Theme extends WP_UnitTestCase { $this->assertIsArray( $theme['Template Files'] ); $this->assertNotEmpty( $theme['Template Files'] ); foreach ( $theme['Template Files'] as $file ) { - $this->assertTrue( is_file( $dir . $file ) ); - $this->assertTrue( is_readable( $dir . $file ) ); + $this->assertFileIsReadable( $dir . $file ); } // CSS files should all exist. $this->assertIsArray( $theme['Stylesheet Files'] ); $this->assertNotEmpty( $theme['Stylesheet Files'] ); foreach ( $theme['Stylesheet Files'] as $file ) { - $this->assertTrue( is_file( $dir . $file ) ); - $this->assertTrue( is_readable( $dir . $file ) ); + $this->assertFileIsReadable( $dir . $file ); } $this->assertTrue( is_dir( $dir . $theme['Template Dir'] ) ); @@ -165,8 +163,7 @@ class Tests_Theme extends WP_UnitTestCase { $this->assertSame( 'publish', $theme['Status'] ); - $this->assertTrue( is_file( $dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot'] ) ); - $this->assertTrue( is_readable( $dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot'] ) ); + $this->assertFileIsReadable( $dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot'] ); } }