Skip to content

Commit

Permalink
test(WPCLI) use the correct PHPUnit assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
lucatume committed Apr 1, 2020
1 parent 07965cd commit 07343f8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/unit/Codeception/Module/WPCLITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

/**
Expand Down

0 comments on commit 07343f8

Please sign in to comment.