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