| @@ 3308-3328 (lines=21) @@ | ||
| 3305 | * @covers PHPUnit_Framework_Constraint_Count |
|
| 3306 | * @covers PHPUnit_Framework_TestFailure::exceptionToString |
|
| 3307 | */ |
|
| 3308 | public function testConstraintCountFailing() |
|
| 3309 | { |
|
| 3310 | $constraint = new PHPUnit_Framework_Constraint_Count(5); |
|
| 3311 | ||
| 3312 | try { |
|
| 3313 | $constraint->evaluate(array(1, 2)); |
|
| 3314 | } catch (PHPUnit_Framework_ExpectationFailedException $e) { |
|
| 3315 | $this->assertEquals( |
|
| 3316 | <<<EOF |
|
| 3317 | Failed asserting that actual size 2 matches expected size 5. |
|
| 3318 | ||
| 3319 | EOF |
|
| 3320 | , |
|
| 3321 | PHPUnit_Framework_TestFailure::exceptionToString($e) |
|
| 3322 | ); |
|
| 3323 | ||
| 3324 | return; |
|
| 3325 | } |
|
| 3326 | ||
| 3327 | $this->fail(); |
|
| 3328 | } |
|
| 3329 | ||
| 3330 | /** |
|
| 3331 | * @covers PHPUnit_Framework_Constraint_Count |
|
| @@ 3336-3358 (lines=23) @@ | ||
| 3333 | * @covers PHPUnit_Framework_Assert::logicalNot |
|
| 3334 | * @covers PHPUnit_Framework_TestFailure::exceptionToString |
|
| 3335 | */ |
|
| 3336 | public function testConstraintNotCountFailing() |
|
| 3337 | { |
|
| 3338 | $constraint = PHPUnit_Framework_Assert::logicalNot( |
|
| 3339 | new PHPUnit_Framework_Constraint_Count(2) |
|
| 3340 | ); |
|
| 3341 | ||
| 3342 | try { |
|
| 3343 | $constraint->evaluate(array(1, 2)); |
|
| 3344 | } catch (PHPUnit_Framework_ExpectationFailedException $e) { |
|
| 3345 | $this->assertEquals( |
|
| 3346 | <<<EOF |
|
| 3347 | Failed asserting that actual size 2 does not match expected size 2. |
|
| 3348 | ||
| 3349 | EOF |
|
| 3350 | , |
|
| 3351 | PHPUnit_Framework_TestFailure::exceptionToString($e) |
|
| 3352 | ); |
|
| 3353 | ||
| 3354 | return; |
|
| 3355 | } |
|
| 3356 | ||
| 3357 | $this->fail(); |
|
| 3358 | } |
|
| 3359 | ||
| 3360 | /** |
|
| 3361 | * @covers PHPUnit_Framework_Constraint_SameSize |
|
| @@ 3425-3447 (lines=23) @@ | ||
| 3422 | * @covers PHPUnit_Framework_Assert::logicalNot |
|
| 3423 | * @covers PHPUnit_Framework_TestFailure::exceptionToString |
|
| 3424 | */ |
|
| 3425 | public function testConstraintNotSameSizeFailing() |
|
| 3426 | { |
|
| 3427 | $constraint = PHPUnit_Framework_Assert::logicalNot( |
|
| 3428 | new PHPUnit_Framework_Constraint_SameSize(array(1, 2)) |
|
| 3429 | ); |
|
| 3430 | ||
| 3431 | try { |
|
| 3432 | $constraint->evaluate(array(3, 4)); |
|
| 3433 | } catch (PHPUnit_Framework_ExpectationFailedException $e) { |
|
| 3434 | $this->assertEquals( |
|
| 3435 | <<<EOF |
|
| 3436 | Failed asserting that actual size 2 does not match expected size 2. |
|
| 3437 | ||
| 3438 | EOF |
|
| 3439 | , |
|
| 3440 | PHPUnit_Framework_TestFailure::exceptionToString($e) |
|
| 3441 | ); |
|
| 3442 | ||
| 3443 | return; |
|
| 3444 | } |
|
| 3445 | ||
| 3446 | $this->fail(); |
|
| 3447 | } |
|
| 3448 | ||
| 3449 | /** |
|
| 3450 | * @covers PHPUnit_Framework_Constraint_Exception |
|