You are here

public static function PHPUnit_Framework_Assert::assertContainsOnlyInstancesOf in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/Assert.php \PHPUnit_Framework_Assert::assertContainsOnlyInstancesOf()

Asserts that a haystack contains only instances of a given classname

Parameters

string $classname:

array|Traversable $haystack:

string $message:

2 calls to PHPUnit_Framework_Assert::assertContainsOnlyInstancesOf()
Framework_AssertTest::testAssertContainsOnlyInstancesOf in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertContainsOnlyInstancesOf
Framework_AssertTest::testAssertContainsOnlyInstancesOfThrowsException in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertContainsOnlyInstancesOf @expectedException PHPUnit_Framework_Exception

File

vendor/phpunit/phpunit/src/Framework/Assert.php, line 291

Class

PHPUnit_Framework_Assert
A set of assert methods.

Code

public static function assertContainsOnlyInstancesOf($classname, $haystack, $message = '') {
  if (!(is_array($haystack) || is_object($haystack) && $haystack instanceof Traversable)) {
    throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'array or traversable');
  }
  self::assertThat($haystack, new PHPUnit_Framework_Constraint_TraversableContainsOnly($classname, false), $message);
}