lithium\test\Unit::assertContainsOnlyInstancesOf PHP Method

assertContainsOnlyInstancesOf() public method

$this->assertContainsOnlyInstancesOf('stdClass', array(new \stdClass)); // succeeds $this->assertContainsOnlyInstancesOf('stdClass', array(new \lithium\test\Unit)); // fails
See also: lithium\test\Unit::assert()
public assertContainsOnlyInstancesOf ( string $class, array | object $haystack, string | boolean $message = '{:message}' ) : boolean
$class string
$haystack array | object Array or iterable object.
$message string | boolean
return boolean `true` if the assertion succeeded, `false` otherwise.
    public function assertContainsOnlyInstancesOf($class, $haystack, $message = '{:message}')
    {
        $result = array();
        foreach ($haystack as $key => &$value) {
            if (!is_a($value, $class)) {
                $result[$key] =& $value;
                break;
            }
        }
        return $this->assert(empty($result), $message, array('expected' => $class, 'result' => $result));
    }