Assert\Assertion::count PHP Method

count() public static method

Assert that the count of countable is equal to count.
public static count ( array | Countable $countable, integer $count, string $message = null, string $propertyPath = null ) : boolean
$countable array | Countable
$count integer
$message string
$propertyPath string
return boolean
    public static function count($countable, $count, $message = null, $propertyPath = null)
    {
        if ($count !== count($countable)) {
            $message = sprintf($message ?: 'List does not contain exactly "%d" elements.', static::stringify($count));
            throw static::createException($countable, $message, static::INVALID_COUNT, $propertyPath, array('count' => $count));
        }
        return true;
    }

Usage Example

 /**
  * @Then I should see the following locales:
  */
 public function iShouldSeeTheFollowingLocales(TableNode $table)
 {
     foreach ($table->getHash() as $row) {
         Assertion::keyExists($this->result, $row['shortcut']);
         Assertion::eq($row['display_name'], $this->result[$row['shortcut']]);
     }
     Assertion::count(iterator_to_array($table), count($this->result));
 }
All Usage Examples Of Assert\Assertion::count