@@ -225,23 +225,31 @@ function ( $world, $path, $type, $action, $expected = null ) {
225225);
226226
227227$ steps ->Then (
228- '/^the contents of the (.+) file should match (((\/.+\/)|(#.+#))([a-z]+)?)$/ ' ,
229- function ( $ world , $ path , $ expected ) {
228+ '/^the contents of the (.+) file should( not)? match (((\/.+\/)|(#.+#))([a-z]+)?)$/ ' ,
229+ function ( $ world , $ path , $ not , $ expected ) {
230230 $ path = $ world ->replace_variables ( $ path );
231231 // If it's a relative path, make it relative to the current test dir.
232232 if ( '/ ' !== $ path [0 ] ) {
233233 $ path = $ world ->variables ['RUN_DIR ' ] . "/ $ path " ;
234234 }
235235 $ contents = file_get_contents ( $ path );
236- Support \assert_regex ( $ expected , $ contents );
236+ if ( $ not ) {
237+ Support \assert_not_regex ( $ expected , $ contents );
238+ } else {
239+ Support \assert_regex ( $ expected , $ contents );
240+ }
237241 }
238242);
239243
240244$ steps ->Then (
241- '/^(STDOUT|STDERR) should match (((\/.+\/)|(#.+#))([a-z]+)?)$/ ' ,
242- function ( $ world , $ stream , $ expected ) {
245+ '/^(STDOUT|STDERR) should( not)? match (((\/.+\/)|(#.+#))([a-z]+)?)$/ ' ,
246+ function ( $ world , $ stream , $ not , $ expected ) {
243247 $ stream = strtolower ( $ stream );
244- Support \assert_regex ( $ expected , $ world ->result ->$ stream );
248+ if ( $ not ) {
249+ Support \assert_not_regex ( $ expected , $ world ->result ->$ stream );
250+ } else {
251+ Support \assert_regex ( $ expected , $ world ->result ->$ stream );
252+ }
245253 }
246254);
247255
0 commit comments