Skip to content

Commit 083a54e

Browse files
authored
Merge pull request #233 from wp-cli/fix/regex
Replace variables in regexes
2 parents e821347 + 51f1de0 commit 083a54e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Context/ThenStepDefinitions.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ public function then_a_specific_file_folder_should_exist( $path, $type, $strictl
243243
* @Then /^the contents of the (.+) file should( not)? match (((\/.+\/)|(#.+#))([a-z]+)?)$/
244244
*/
245245
public function then_the_contents_of_a_specific_file_should_match( $path, $not, $expected ) {
246-
$path = $this->replace_variables( $path );
246+
$path = $this->replace_variables( $path );
247+
$expected = $this->replace_variables( $expected );
248+
247249
// If it's a relative path, make it relative to the current test dir.
248250
if ( '/' !== $path[0] ) {
249251
$path = $this->variables['RUN_DIR'] . "/$path";
@@ -260,6 +262,8 @@ public function then_the_contents_of_a_specific_file_should_match( $path, $not,
260262
* @Then /^(STDOUT|STDERR) should( not)? match (((\/.+\/)|(#.+#))([a-z]+)?)$/
261263
*/
262264
public function then_stdout_stderr_should_match_a_string( $stream, $not, $expected ) {
265+
$expected = $this->replace_variables( $expected );
266+
263267
$stream = strtolower( $stream );
264268
if ( $not ) {
265269
$this->assert_not_regex( $expected, $this->result->$stream );

0 commit comments

Comments
 (0)