@@ -152,7 +152,7 @@ function ( $world, $stream, $operator, $goal_ver ) {
152
152
throw new Exception ( $ world ->result );
153
153
}
154
154
}
155
- );
155
+ );
156
156
157
157
$ steps ->Then ( '/^the (.+) (file|directory) should (exist|not exist|be:|contain:|not contain:)$/ ' ,
158
158
function ( $ world , $ path , $ type , $ action , $ expected = null ) {
@@ -199,6 +199,28 @@ function ( $world, $path, $type, $action, $expected = null ) {
199
199
}
200
200
);
201
201
202
+ $ steps ->Then ( '/^the contents of the (.+) file should match (((\/.+\/)|(#.+#))([a-z]+)?)$/ ' ,
203
+ function ( $ world , $ path , $ expected ) {
204
+ $ path = $ world ->replace_variables ( $ path );
205
+
206
+ // If it's a relative path, make it relative to the current test dir
207
+ if ( '/ ' !== $ path [0 ] ) {
208
+ $ path = $ world ->variables ['RUN_DIR ' ] . "/ $ path " ;
209
+ }
210
+
211
+ $ contents = file_get_contents ( $ path );
212
+ assertRegExp ( $ expected , $ contents );
213
+ }
214
+ );
215
+
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
+
202
224
$ steps ->Then ( '/^an email should (be sent|not be sent)$/ ' , function ( $ world , $ expected ) {
203
225
if ( 'be sent ' === $ expected ) {
204
226
assertNotEquals ( 0 , $ world ->email_sends );
0 commit comments