Skip to content

Commit b93e91f

Browse files
committed
[Asserts] Added new asserts
* Added StringContainsString family of methods * Added all assertIsX methods except assertIsIterable * Removed deprecated assertGreaterThen and assertGreaterThenOrEqual methods (assertGreaterThan and assertGreaterThanOrEqual methods still exist) * Reverted HHVM specific workaround for importing methods by changing visibility
1 parent 47a7b83 commit b93e91f

File tree

1 file changed

+120
-26
lines changed

1 file changed

+120
-26
lines changed

src/Codeception/Util/Shared/Asserts.php

+120-26
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,6 @@ protected function assertGreaterThan($expected, $actual, $message = '')
8686
\PHPUnit\Framework\Assert::assertGreaterThan($expected, $actual, $message);
8787
}
8888

89-
/**
90-
* @deprecated
91-
*/
92-
protected function assertGreaterThen($expected, $actual, $message = '')
93-
{
94-
\PHPUnit\Framework\Assert::assertGreaterThan($expected, $actual, $message);
95-
}
96-
9789
/**
9890
* Checks that actual is greater or equal than expected
9991
*
@@ -106,14 +98,6 @@ protected function assertGreaterThanOrEqual($expected, $actual, $message = '')
10698
\PHPUnit\Framework\Assert::assertGreaterThanOrEqual($expected, $actual, $message);
10799
}
108100

109-
/**
110-
* @deprecated
111-
*/
112-
protected function assertGreaterThenOrEqual($expected, $actual, $message = '')
113-
{
114-
\PHPUnit\Framework\Assert::assertGreaterThanOrEqual($expected, $actual, $message);
115-
}
116-
117101
/**
118102
* Checks that actual is less than expected
119103
*
@@ -163,16 +147,6 @@ protected function assertNotContains($needle, $haystack, $message = '')
163147
\PHPUnit\Framework\Assert::assertNotContains($needle, $haystack, $message);
164148
}
165149

166-
protected function assertStringContainsString($needle, $haystack, $message = '')
167-
{
168-
\Codeception\PHPUnit\TestCase::assertStringContainsString($needle, $haystack, $message = '');
169-
}
170-
171-
protected function assertStringNotContainsString($needle, $haystack, $message = '')
172-
{
173-
\Codeception\PHPUnit\TestCase::assertStringNotContainsString($needle, $haystack, $message = '');
174-
}
175-
176150
/**
177151
* Checks that string match with pattern
178152
*
@@ -469,4 +443,124 @@ protected function fail($message)
469443
{
470444
\PHPUnit\Framework\Assert::fail($message);
471445
}
446+
447+
protected function assertStringContainsString($needle, $haystack, $message = '')
448+
{
449+
\Codeception\PHPUnit\TestCase::assertStringContainsString($needle, $haystack, $message);
450+
}
451+
452+
protected function assertStringNotContainsString($needle, $haystack, $message = '')
453+
{
454+
\Codeception\PHPUnit\TestCase::assertStringNotContainsString($needle, $haystack, $message);
455+
}
456+
457+
protected function assertStringContainsStringIgnoringCase($needle, $haystack, $message = '')
458+
{
459+
\Codeception\PHPUnit\TestCase::assertStringContainsStringIgnoringCase($needle, $haystack, $message);
460+
}
461+
462+
protected function assertStringNotContainsStringIgnoringCase($needle, $haystack, $message = '')
463+
{
464+
\Codeception\PHPUnit\TestCase::assertStringNotContainsStringIgnoringCase($needle, $haystack, $message);
465+
}
466+
467+
protected function assertIsArray($actual, $message = '')
468+
{
469+
\Codeception\PHPUnit\TestCase::assertIsArray($actual, $message);
470+
}
471+
472+
protected function assertIsBool($actual, $message = '')
473+
{
474+
\Codeception\PHPUnit\TestCase::assertIsBool($actual, $message);
475+
}
476+
477+
protected function assertIsFloat($actual, $message = '')
478+
{
479+
\Codeception\PHPUnit\TestCase::assertIsFloat($actual, $message);
480+
}
481+
482+
protected function assertIsInt($actual, $message = '')
483+
{
484+
\Codeception\PHPUnit\TestCase::assertIsInt($actual, $message);
485+
}
486+
487+
protected function assertIsNumeric($actual, $message = '')
488+
{
489+
\Codeception\PHPUnit\TestCase::assertIsNumeric($actual, $message);
490+
}
491+
492+
protected function assertIsObject($actual, $message = '')
493+
{
494+
\Codeception\PHPUnit\TestCase::assertIsObject($actual, $message);
495+
}
496+
497+
protected function assertIsResource($actual, $message = '')
498+
{
499+
\Codeception\PHPUnit\TestCase::assertIsResource($actual, $message);
500+
}
501+
502+
protected function assertIsString($actual, $message = '')
503+
{
504+
\Codeception\PHPUnit\TestCase::assertIsString($actual, $message);
505+
}
506+
507+
protected function assertIsScalar($actual, $message = '')
508+
{
509+
\Codeception\PHPUnit\TestCase::assertIsScalar($actual, $message);
510+
}
511+
512+
protected function assertIsCallable($actual, $message = '')
513+
{
514+
\Codeception\PHPUnit\TestCase::assertIsCallable($actual, $message);
515+
}
516+
517+
protected function assertIsNotArray($actual, $message = '')
518+
{
519+
\Codeception\PHPUnit\TestCase::assertIsNotArray($actual, $message);
520+
}
521+
522+
protected function assertIsNotBool($actual, $message = '')
523+
{
524+
\Codeception\PHPUnit\TestCase::assertIsNotBool($actual, $message);
525+
}
526+
527+
protected function assertIsNotFloat($actual, $message = '')
528+
{
529+
\Codeception\PHPUnit\TestCase::assertIsNotFloat($actual, $message);
530+
}
531+
532+
protected function assertIsNotInt($actual, $message = '')
533+
{
534+
\Codeception\PHPUnit\TestCase::assertIsNotInt($actual, $message);
535+
}
536+
537+
protected function assertIsNotNumeric($actual, $message = '')
538+
{
539+
\Codeception\PHPUnit\TestCase::assertIsNotNumeric($actual, $message);
540+
}
541+
542+
protected function assertIsNotObject($actual, $message = '')
543+
{
544+
\Codeception\PHPUnit\TestCase::assertIsNotObject($actual, $message);
545+
}
546+
547+
protected function assertIsNotResource($actual, $message = '')
548+
{
549+
\Codeception\PHPUnit\TestCase::assertIsNotResource($actual, $message);
550+
}
551+
552+
protected function assertIsNotString($actual, $message = '')
553+
{
554+
\Codeception\PHPUnit\TestCase::assertIsNotString($actual, $message);
555+
}
556+
557+
protected function assertIsNotScalar($actual, $message = '')
558+
{
559+
\Codeception\PHPUnit\TestCase::assertIsNotScalar($actual, $message);
560+
}
561+
562+
protected function assertIsNotCallable($actual, $message = '')
563+
{
564+
\Codeception\PHPUnit\TestCase::assertIsNotCallable($actual, $message);
565+
}
472566
}

0 commit comments

Comments
 (0)