|
3 | 3 | namespace Codeception\PHPUnit;
|
4 | 4 |
|
5 | 5 |
|
| 6 | +use PHPUnit\Framework\AssertionFailedError; |
| 7 | + |
6 | 8 | abstract class TestCase extends \PHPUnit\Framework\TestCase
|
7 | 9 | {
|
8 | 10 |
|
@@ -36,11 +38,47 @@ public static function tearDownAfterClass()
|
36 | 38 |
|
37 | 39 | public static function assertStringContainsString($needle, $haystack, $message = '')
|
38 | 40 | {
|
39 |
| - \Codeception\PHPUnit\TestCase::assertContains($needle, $haystack, $message = ''); |
| 41 | + if (!is_string($needle)) { |
| 42 | + throw new AssertionFailedError('Needle is not string'); |
| 43 | + } |
| 44 | + if (!is_string($haystack)) { |
| 45 | + throw new AssertionFailedError('Haystack is not string'); |
| 46 | + } |
| 47 | + \Codeception\PHPUnit\TestCase::assertContains($needle, $haystack, $message); |
40 | 48 | }
|
41 | 49 |
|
42 | 50 | public static function assertStringNotContainsString($needle, $haystack, $message = '')
|
43 | 51 | {
|
44 |
| - \Codeception\PHPUnit\TestCase::assertNotContains($needle, $haystack, $message = ''); |
| 52 | + |
| 53 | + if (!is_string($needle)) { |
| 54 | + throw new AssertionFailedError('Needle is not string'); |
| 55 | + } |
| 56 | + if (!is_string($haystack)) { |
| 57 | + throw new AssertionFailedError('Haystack is not string'); |
| 58 | + } |
| 59 | + \Codeception\PHPUnit\TestCase::assertNotContains($needle, $haystack, $message); |
| 60 | + } |
| 61 | + |
| 62 | + public static function assertStringContainsStringIgnoringCase($needle, $haystack, $message = '') |
| 63 | + { |
| 64 | + if (!is_string($needle)) { |
| 65 | + throw new AssertionFailedError('Needle is not string'); |
| 66 | + } |
| 67 | + if (!is_string($haystack)) { |
| 68 | + throw new AssertionFailedError('Haystack is not string'); |
| 69 | + } |
| 70 | + \Codeception\PHPUnit\TestCase::assertContains($needle, $haystack, $message, true); |
| 71 | + } |
| 72 | + |
| 73 | + public static function assertStringNotContainsStringIgnoringCase($needle, $haystack, $message = '') |
| 74 | + { |
| 75 | + |
| 76 | + if (!is_string($needle)) { |
| 77 | + throw new AssertionFailedError('Needle is not string'); |
| 78 | + } |
| 79 | + if (!is_string($haystack)) { |
| 80 | + throw new AssertionFailedError('Haystack is not string'); |
| 81 | + } |
| 82 | + \Codeception\PHPUnit\TestCase::assertNotContains($needle, $haystack, $message, true); |
45 | 83 | }
|
46 | 84 | }
|
0 commit comments