From 07343f8c7b344e9bbf28443ea7be9206e30114f0 Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Wed, 1 Apr 2020 17:13:27 +0200 Subject: [PATCH] test(WPCLI) use the correct PHPUnit assertion --- tests/unit/Codeception/Module/WPCLITest.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/unit/Codeception/Module/WPCLITest.php b/tests/unit/Codeception/Module/WPCLITest.php index b211d83ec..91ba35f52 100644 --- a/tests/unit/Codeception/Module/WPCLITest.php +++ b/tests/unit/Codeception/Module/WPCLITest.php @@ -256,9 +256,15 @@ public function it_should_cast_wp_cli_errors_to_exceptions_if_specified_in_confi ->willReturn($mockProcess->reveal()); $this->expectException(ModuleException::class); - $this->expectExceptionMessageRegExp('/'.preg_quote($error, '/').'/'); - $cli->cli('core version'); + $pattern = '/' . preg_quote( $error, '/' ) . '/'; + if (method_exists($this,'expectExceptionMessageMatches')) { + $this->expectExceptionMessageMatches( $pattern ); + }else{ + $this->expectExceptionMessageRegExp( $pattern ); + } + + $cli->cli('core version'); } /**