Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #242 from elliotchance/1.7/216-allow-verify
1.7/216 allow verify
- Loading branch information
Showing
2 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace Concise\Mock; | ||
|
||
use Colors\Color; | ||
use Concise\TestCase; | ||
|
||
class VerifyFailuresTest extends TestCase | ||
{ | ||
protected static $failures = array(); | ||
|
||
protected static $expectedFailures = array( | ||
'testMultipleVerifyFailures' => "2 verify failures:\n\n10 equals 15\n\n15 equals 20", | ||
'testSingleVerifyFailures' => "1 verify failure:\n\n10 equals 15", | ||
); | ||
|
||
/** | ||
* @group #216 | ||
*/ | ||
public function testMultipleVerifyFailures() | ||
{ | ||
$this->verify(10, equals, 15); | ||
$this->verify(15, equals, 20); | ||
} | ||
|
||
/** | ||
* @group #216 | ||
*/ | ||
public function testSingleVerifyFailures() | ||
{ | ||
$this->verify(10, equals, 15); | ||
} | ||
|
||
protected function onNotSuccessfulTest(\Exception $e) | ||
{ | ||
$c = new Color(); | ||
self::$failures[] = $this->getName(); | ||
$this->assert(self::$expectedFailures[$this->getName()], equals, $c($e->getMessage())->clean()); | ||
} | ||
|
||
public static function tearDownAfterClass() | ||
{ | ||
$a = array_keys(self::$expectedFailures); | ||
$b = self::$failures; | ||
$testCase = new TestCase(); | ||
$testCase->setUp(); | ||
$testCase->assert(array_diff($a, $b), equals, array_diff($b, $a)); | ||
$testCase->tearDown(); | ||
} | ||
} |