You are here

public static function PHPUnit_Framework_Assert::assertSameSize in Zircon Profile 8

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

Assert that the size of two arrays (or `Countable` or `Traversable` objects) is the same.

Parameters

array|Countable|Traversable $expected:

array|Countable|Traversable $actual:

string $message:

3 calls to PHPUnit_Framework_Assert::assertSameSize()
Framework_AssertTest::testAssertSameSize in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertSameSize
Framework_AssertTest::testAssertSameSizeThrowsExceptionIfActualIsNotCountable in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertSameSize
Framework_AssertTest::testAssertSameSizeThrowsExceptionIfExpectedIsNotCountable in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertSameSize

File

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

Class

PHPUnit_Framework_Assert
A set of assert methods.

Code

public static function assertSameSize($expected, $actual, $message = '') {
  if (!$expected instanceof Countable && !$expected instanceof Traversable && !is_array($expected)) {
    throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'countable or traversable');
  }
  if (!$actual instanceof Countable && !$actual instanceof Traversable && !is_array($actual)) {
    throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'countable or traversable');
  }
  self::assertThat($actual, new PHPUnit_Framework_Constraint_SameSize($expected), $message);
}