|
@@ 1498-1517 (lines=20) @@
|
| 1495 |
|
* @param array|Countable|Traversable $actual |
| 1496 |
|
* @param string $message |
| 1497 |
|
*/ |
| 1498 |
|
public static function assertSameSize($expected, $actual, $message = '') |
| 1499 |
|
{ |
| 1500 |
|
if (!$expected instanceof Countable && |
| 1501 |
|
!$expected instanceof Traversable && |
| 1502 |
|
!is_array($expected)) { |
| 1503 |
|
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'countable or traversable'); |
| 1504 |
|
} |
| 1505 |
|
|
| 1506 |
|
if (!$actual instanceof Countable && |
| 1507 |
|
!$actual instanceof Traversable && |
| 1508 |
|
!is_array($actual)) { |
| 1509 |
|
throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'countable or traversable'); |
| 1510 |
|
} |
| 1511 |
|
|
| 1512 |
|
self::assertThat( |
| 1513 |
|
$actual, |
| 1514 |
|
new PHPUnit_Framework_Constraint_SameSize($expected), |
| 1515 |
|
$message |
| 1516 |
|
); |
| 1517 |
|
} |
| 1518 |
|
|
| 1519 |
|
/** |
| 1520 |
|
* Assert that the size of two arrays (or `Countable` or `Traversable` objects) |
|
@@ 1527-1546 (lines=20) @@
|
| 1524 |
|
* @param array|Countable|Traversable $actual |
| 1525 |
|
* @param string $message |
| 1526 |
|
*/ |
| 1527 |
|
public static function assertNotSameSize($expected, $actual, $message = '') |
| 1528 |
|
{ |
| 1529 |
|
if (!$expected instanceof Countable && |
| 1530 |
|
!$expected instanceof Traversable && |
| 1531 |
|
!is_array($expected)) { |
| 1532 |
|
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'countable or traversable'); |
| 1533 |
|
} |
| 1534 |
|
|
| 1535 |
|
if (!$actual instanceof Countable && |
| 1536 |
|
!$actual instanceof Traversable && |
| 1537 |
|
!is_array($actual)) { |
| 1538 |
|
throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'countable or traversable'); |
| 1539 |
|
} |
| 1540 |
|
|
| 1541 |
|
$constraint = new PHPUnit_Framework_Constraint_Not( |
| 1542 |
|
new PHPUnit_Framework_Constraint_SameSize($expected) |
| 1543 |
|
); |
| 1544 |
|
|
| 1545 |
|
self::assertThat($actual, $constraint, $message); |
| 1546 |
|
} |
| 1547 |
|
|
| 1548 |
|
/** |
| 1549 |
|
* Asserts that a string matches a given format string. |