public static function PHPUnit_Framework_Assert::assertCount

Asserts the number of elements of an array, Countable or Iterator.

Parameters

integer $expectedCount:

mixed $haystack:

string $message:

5 calls to PHPUnit_Framework_Assert::assertCount()
Framework_AssertTest::testAssertCount in drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertCount
Framework_AssertTest::testAssertCountThrowsExceptionIfElementIsNotCountable in drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertCount
Framework_AssertTest::testAssertCountThrowsExceptionIfExpectedCountIsNoInteger in drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertCount
PHPUnit_Framework_Assert::assertAttributeCount in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Assert.php
Asserts the number of elements of an array, Countable or Iterator that is stored in an attribute.
Twig_Tests_EnvironmentTest::testRemoveExtension in drupal/core/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php

File

drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Assert.php, line 375

Class

PHPUnit_Framework_Assert
A set of assert methods.

Code

public static function assertCount($expectedCount, $haystack, $message = '') {
  if (!is_int($expectedCount)) {
    throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer');
  }
  if (!$haystack instanceof Countable && !$haystack instanceof Iterator && !is_array($haystack)) {
    throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'countable');
  }
  self::assertThat($haystack, new PHPUnit_Framework_Constraint_Count($expectedCount), $message);
}