From ac5076ad8e40576b7af102265ff8340ef8058998 Mon Sep 17 00:00:00 2001 From: Max Rice Date: Fri, 5 Sep 2014 19:21:31 -0400 Subject: [PATCH] Fix failing tests in PHP 5.2 --- tests/framework/class-wc-unit-test-case.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/framework/class-wc-unit-test-case.php b/tests/framework/class-wc-unit-test-case.php index 330b24e2f5043..616f66a46c48e 100644 --- a/tests/framework/class-wc-unit-test-case.php +++ b/tests/framework/class-wc-unit-test-case.php @@ -67,4 +67,24 @@ public function assertNotWPError( $actual, $message = '' ) { $this->assertNotInstanceOf( 'WP_Error', $actual, $message ); } + /** + * Backport assertNotFalse to PHPUnit 3.6.12 which only runs in PHP 5.2 + * + * @since 2.2 + * @param $condition + * @param string $message + * @return mixed + */ + public static function assertNotFalse( $condition, $message = '' ) { + + if ( version_compare( phpversion(), '5.2', '<' ) ) { + + self::assertThat( $condition, self::logicalNot( self::isFalse() ), $message ); + + } else { + + parent::assertNotFalse( $condition, $message ); + } + } + }