WordPress.org

Make WordPress Core

Ticket #53363: 53363-03-use-assertdirectoryexists.patch

File 53363-03-use-assertdirectoryexists.patch, 1.0 KB (added by jrf, 5 months ago)

Use more appropriate assertion [2] - this assertion is available PHPUnit cross-version, so can already be used

  • tests/phpunit/tests/theme.php

    From 90ee76e84b52cf14504b83a20be8a994115896a5 Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Tue, 20 Jul 2021 11:20:07 +0200
    Subject: [PATCH 2/2] Build/Tests: use more appropriate assertions [2]
    
    PHPUnit has a build in assertion to verify that a directory exists. Let's use it.
    ---
     tests/phpunit/tests/theme.php | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/tests/phpunit/tests/theme.php b/tests/phpunit/tests/theme.php
    index 7de707e3fe..bf59831e4c 100644
    a b class Tests_Theme extends WP_UnitTestCase_Base { 
    158158                                $this->assertFileIsReadable( $dir . $file );
    159159                        }
    160160
    161                         $this->assertTrue( is_dir( $dir . $theme['Template Dir'] ) );
    162                         $this->assertTrue( is_dir( $dir . $theme['Stylesheet Dir'] ) );
     161                        $this->assertDirectoryExists( $dir . $theme['Template Dir'] );
     162                        $this->assertDirectoryExists( $dir . $theme['Stylesheet Dir'] );
    163163
    164164                        $this->assertSame( 'publish', $theme['Status'] );
    165165