Skip to content

Commit

Permalink
Replace variables in regexes
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Dec 18, 2024
1 parent e821347 commit 51f1de0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Context/ThenStepDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ public function then_a_specific_file_folder_should_exist( $path, $type, $strictl
* @Then /^the contents of the (.+) file should( not)? match (((\/.+\/)|(#.+#))([a-z]+)?)$/
*/
public function then_the_contents_of_a_specific_file_should_match( $path, $not, $expected ) {
$path = $this->replace_variables( $path );
$path = $this->replace_variables( $path );
$expected = $this->replace_variables( $expected );

// If it's a relative path, make it relative to the current test dir.
if ( '/' !== $path[0] ) {
$path = $this->variables['RUN_DIR'] . "/$path";
Expand All @@ -260,6 +262,8 @@ public function then_the_contents_of_a_specific_file_should_match( $path, $not,
* @Then /^(STDOUT|STDERR) should( not)? match (((\/.+\/)|(#.+#))([a-z]+)?)$/
*/
public function then_stdout_stderr_should_match_a_string( $stream, $not, $expected ) {
$expected = $this->replace_variables( $expected );

$stream = strtolower( $stream );
if ( $not ) {
$this->assert_not_regex( $expected, $this->result->$stream );
Expand Down

0 comments on commit 51f1de0

Please sign in to comment.