Skip to content

Commit 33c371f

Browse files
committed
add regex based context to test stdout
1 parent c268382 commit 33c371f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

features/steps/then.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ function ( $world, $path, $type, $action, $expected = null ) {
199199
}
200200
);
201201

202-
$steps->Then( '/^the (.+) file should match (((\/.+\/)|(#.+#))([a-z]+)?)$/',
203-
function ( $world, $path, $expected = null ) {
202+
$steps->Then( '/^the contents of the (.+) file should match (((\/.+\/)|(#.+#))([a-z]+)?)$/',
203+
function ( $world, $path, $expected ) {
204204
$path = $world->replace_variables( $path );
205205

206206
// If it's a relative path, make it relative to the current test dir
@@ -213,6 +213,14 @@ function ( $world, $path, $expected = null ) {
213213
}
214214
);
215215

216+
$steps->Then( '/^(STDOUT|STDERR) should match (((\/.+\/)|(#.+#))([a-z]+)?)$/',
217+
function ( $world, $stream, $expected ) {
218+
219+
$stream = strtolower( $stream );
220+
assertRegExp( $expected, $world->result->$stream );
221+
}
222+
);
223+
216224
$steps->Then( '/^an email should (be sent|not be sent)$/', function( $world, $expected ) {
217225
if ( 'be sent' === $expected ) {
218226
assertNotEquals( 0, $world->email_sends );

0 commit comments

Comments
 (0)