setExpectedExceptionRegExp($this->getExpectedException(), $regularExpression); } } } // PHPUnit <= 7 trait AssertContainsForwardCompatibility { public static function assertStringContainsString($needle, $haystack, $message = '') { static::assertContains((string) $needle, (string) $haystack, $message); } public static function assertStringContainsStringIgnoringCase($needle, $haystack, $message = '') { static::assertContains((string) $needle, (string) $haystack, $message, true); } public static function assertStringNotContainsString($needle, $haystack, $message = '') { static::assertNotContains((string) $needle, (string) $haystack, $message); } public static function assertStringNotContainsStringIgnoringCase($needle, $haystack, $message = '') { static::assertNotContains((string) $needle, (string) $haystack, $message, true); } } if (\method_exists(\PHPUnit\Framework\TestCase::class, 'assertStringContainsString')) { if (\method_exists(\PHPUnit\Framework\TestCase::class, 'expectExceptionMessageMatches')) { if (\method_exists(\PHPUnit\Framework\TestCase::class, 'assertMatchesRegularExpression')) { abstract class TestCase extends \PHPUnit\Framework\TestCase { // No forward compatibility needed! } } else { abstract class TestCase extends \PHPUnit\Framework\TestCase { use AssertMatchesRegularExpressionForwardCompatibility; } } } else { abstract class TestCase extends \PHPUnit\Framework\TestCase { use AssertMatchesRegularExpressionForwardCompatibility; use ExpectExceptionMessagMatchesForwardCompatibility; } } } else { abstract class TestCase extends \PHPUnit\Framework\TestCase { use AssertContainsForwardCompatibility; use AssertMatchesRegularExpressionForwardCompatibility; use ExpectExceptionMessagMatchesForwardCompatibility; } }