Asserts that a haystack contains a needle.
@since Method available since Release 2.1.0
mixed $needle:
mixed $haystack:
string $message:
boolean $ignoreCase:
boolean $checkForObjectIdentity:
public static function assertContains($needle, $haystack, $message = '', $ignoreCase = FALSE, $checkForObjectIdentity = TRUE) {
if (is_array($haystack) || is_object($haystack) && $haystack instanceof Traversable) {
$constraint = new PHPUnit_Framework_Constraint_TraversableContains($needle, $checkForObjectIdentity);
}
else {
if (is_string($haystack)) {
$constraint = new PHPUnit_Framework_Constraint_StringContains($needle, $ignoreCase);
}
else {
throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'array, iterator or string');
}
}
self::assertThat($haystack, $constraint, $message);
}