lithium\test\Unit::assertNotContainsOnly()
Assert that $haystack hasn't any items of given type.
$this->assertNotContainsOnly('integer', ['foo', 'bar', 'baz']); // succeeds
$this->assertNotContainsOnly('integer', [1,2,3]); // fails
Parameters
-
string
$type -
array|object
$haystackArray or iterable object.
-
string|boolean
$message
Returns
booleantrue if the assertion succeeded, false otherwise.
Source
public function assertNotContainsOnly($type, $haystack, $message = '{:message}') {
$method = static::$_internalTypes[$type];
foreach ($haystack as $key => $value) {
if (!$method($value)) {
return $this->assert(true, $message, [
'expected' => $type,
'result' => $haystack
]);
}
}
return $this->assert(false, $message, [
'expected' => $type,
'result' => $haystack
]);
}