lithium\test\Unit::assertCount()
Assert that the passed result array has expected number of elements.
$this->assertCount(1, ['foo']); // succeeds
$this->assertCount(2, ['foo', 'bar', 'bar']); // fails
Parameters
-
integer
$expected
-
array
$array
-
string|boolean
$message
Returns
booleantrue
if the assertion succeeded, false
otherwise.
Source
public function assertCount($expected, $array, $message = '{:message}') {
return $this->assert($expected === ($result = count($array)), $message, [
'expected' => $expected,
'result' => $result
]);
}