PHPUnit_Framework_Assert::assertNotCount PHP Method

assertNotCount() public static method

Asserts the number of elements of an array, Countable or Traversable.
public static assertNotCount ( integer $expectedCount, mixed $haystack, string $message = '' )
$expectedCount integer
$haystack mixed
$message string
    public static function assertNotCount($expectedCount, $haystack, $message = '')
    {
        if (!is_int($expectedCount)) {
            throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer');
        }
        if (!$haystack instanceof Countable && !$haystack instanceof Traversable && !is_array($haystack)) {
            throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'countable or traversable');
        }
        $constraint = new PHPUnit_Framework_Constraint_Not(new PHPUnit_Framework_Constraint_Count($expectedCount));
        static::assertThat($haystack, $constraint, $message);
    }

Usage Example

Example #1
0
 public function toHaveCount($count)
 {
     if ($this->negate) {
         a::assertNotCount($count, $this->actual);
     } else {
         a::assertCount($count, $this->actual);
     }
 }
All Usage Examples Of PHPUnit_Framework_Assert::assertNotCount
PHPUnit_Framework_Assert