Skip to content

Commit 316d1d5

Browse files
committed
Added new methods for regex and notFileExists
* assertMatchesRegularExpression * assertDoesNotMatchRegularExpression * assertFileDoesNotExist
1 parent 9c5df6f commit 316d1d5

File tree

1 file changed

+40
-3
lines changed

1 file changed

+40
-3
lines changed

src/Codeception/Util/Shared/Asserts.php

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,22 @@ protected function assertNotContains($needle, $haystack, $message = '')
160160
*/
161161
protected function assertRegExp($pattern, $string, $message = '')
162162
{
163+
TestCase::assertRegExp($pattern, $string, $message);
164+
}
163165

166+
/**
167+
* Checks that string match with pattern
168+
*
169+
* Alias of assertRegExp
170+
* @param string $pattern
171+
* @param string $string
172+
* @param string $message
173+
*/
174+
protected function assertMatchesRegularExpression($pattern, $string, $message = '')
175+
{
164176
TestCase::assertRegExp($pattern, $string, $message);
165177
}
166-
178+
167179
/**
168180
* Checks that string not match with pattern
169181
*
@@ -176,6 +188,19 @@ protected function assertNotRegExp($pattern, $string, $message = '')
176188
TestCase::assertNotRegExp($pattern, $string, $message);
177189
}
178190

191+
/**
192+
* Checks that string not match with pattern
193+
*
194+
* Alias of assertNotRegExp
195+
* @param string $pattern
196+
* @param string $string
197+
* @param string $message
198+
*/
199+
protected function assertDoesNotMatchRegularExpression($pattern, $string, $message = '')
200+
{
201+
TestCase::assertNotRegExp($pattern, $string, $message);
202+
}
203+
179204
/**
180205
* Checks that a string starts with the given prefix.
181206
*
@@ -324,8 +349,8 @@ protected function assertFileExists($filename, $message = '')
324349
{
325350
Assert::assertFileExists($filename, $message);
326351
}
327-
328-
352+
353+
329354
/**
330355
* Checks if file doesn't exist
331356
*
@@ -337,6 +362,18 @@ protected function assertFileNotExists($filename, $message = '')
337362
TestCase::assertFileNotExists($filename, $message);
338363
}
339364

365+
/**
366+
* Checks if file doesn't exist
367+
*
368+
* Alias of assertFileNotExists
369+
* @param string $filename
370+
* @param string $message
371+
*/
372+
protected function assertFileDoesNotExist($filename, $message = '')
373+
{
374+
TestCase::assertFileNotExists($filename, $message);
375+
}
376+
340377
/**
341378
* @param $expected
342379
* @param $actual

0 commit comments

Comments
 (0)