public static function PHPUnit_Framework_Assert::assertContainsOnly in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/phpunit/src/Framework/Assert.php \PHPUnit_Framework_Assert::assertContainsOnly()
Asserts that a haystack contains only values of a given type.
@since Method available since Release 3.1.4
Parameters
string $type:
mixed $haystack:
bool $isNativeType:
string $message:
4 calls to PHPUnit_Framework_Assert::assertContainsOnly()
- Framework_AssertTest::testAssertArrayContainsOnlyIntegers in vendor/
phpunit/ phpunit/ tests/ Framework/ AssertTest.php - @covers PHPUnit_Framework_Assert::assertContainsOnly
- Framework_AssertTest::testAssertArrayContainsOnlyStdClass in vendor/
phpunit/ phpunit/ tests/ Framework/ AssertTest.php - @covers PHPUnit_Framework_Assert::assertContainsOnly
- Framework_AssertTest::testAssertContainsOnlyThrowsException in vendor/
phpunit/ phpunit/ tests/ Framework/ AssertTest.php - @covers PHPUnit_Framework_Assert::assertContainsOnly @expectedException PHPUnit_Framework_Exception
- PHPUnit_Framework_Assert::assertAttributeContainsOnly in vendor/
phpunit/ phpunit/ src/ Framework/ Assert.php - Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains only values of a given type.
File
- vendor/
phpunit/ phpunit/ src/ Framework/ Assert.php, line 260
Class
- PHPUnit_Framework_Assert
- A set of assert methods.
Code
public static function assertContainsOnly($type, $haystack, $isNativeType = null, $message = '') {
if (!(is_array($haystack) || is_object($haystack) && $haystack instanceof Traversable)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'array or traversable');
}
if ($isNativeType == null) {
$isNativeType = PHPUnit_Util_Type::isType($type);
}
self::assertThat($haystack, new PHPUnit_Framework_Constraint_TraversableContainsOnly($type, $isNativeType), $message);
}