Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Replace variables in regexes #233

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading