Make WordPress Core

Changeset 51579


Ignore:
Timestamp:
08/07/2021 02:15:42 PM (3 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/theme.php

    r51568 r51579  
    149149            $this->assertNotEmpty( $theme['Template Files'] );
    150150            foreach ( $theme['Template Files'] as $file ) {
    151                 $this->assertTrue( is_file( $dir . $file ) );
    152                 $this->assertTrue( is_readable( $dir . $file ) );
     151                $this->assertFileIsReadable( $dir . $file );
    153152            }
    154153
     
    157156            $this->assertNotEmpty( $theme['Stylesheet Files'] );
    158157            foreach ( $theme['Stylesheet Files'] as $file ) {
    159                 $this->assertTrue( is_file( $dir . $file ) );
    160                 $this->assertTrue( is_readable( $dir . $file ) );
     158                $this->assertFileIsReadable( $dir . $file );
    161159            }
    162160
     
    166164            $this->assertSame( 'publish', $theme['Status'] );
    167165
    168             $this->assertTrue( is_file( $dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot'] ) );
    169             $this->assertTrue( is_readable( $dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot'] ) );
     166            $this->assertFileIsReadable( $dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot'] );
    170167        }
    171168    }
Note: See TracChangeset for help on using the changeset viewer.