diff --git a/tests/phpunit/WordPressCoreInstallerTest.php b/tests/phpunit/WordPressCoreInstallerTest.php
index <HASH>..<HASH> 100644
--- a/tests/phpunit/WordPressCoreInstallerTest.php
+++ b/tests/phpunit/WordPressCoreInstallerTest.php
@@ -175,8 +175,15 @@ class WordPressCoreInstallerTest extends TestCase {
 	private function jpbExpectException( $class, $message = '', $isRegExp = false ) {
 		$this->expectException($class);
 		if ( $message ) {
-			$isRegExp || $this->expectExceptionMessage( $message );
-			$isRegExp && $this->expectExceptionMessageRegExp( $message );
+			if ( $isRegExp ) {
+				if ( method_exists( $this, 'expectExceptionMessageRegExp' ) ) {
+					$this->expectExceptionMessageRegExp( $message );
+				} else {
+					$this->expectExceptionMessageMatches( $message );
+				}
+			} else {
+				$this->expectExceptionMessage( $message );
+			}
 		}
 	}
Update test helpers to get regex matching working on latest version of phpunit