Created
October 27, 2012 19:55
-
-
Save dharkness/3965902 to your computer and use it in GitHub Desktop.
Using Hamcrest matchers with PHPUnit
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
<?php | |
class Hamcrest_Integration_PHPUnit_TestCase extends PHPUnit_Framework_TestCase | |
{ | |
/** | |
* Collects assertions performed by Hamcrest matchers during the test. | |
*/ | |
public function runBare() { | |
Hamcrest_MatcherAssert::resetCount(); | |
try { | |
parent::runBare(); | |
} | |
catch (Exception $e) { | |
// rethrown below | |
} | |
$this->addToAssertionCount(Hamcrest_MatcherAssert::getCount()); | |
if ($e) { | |
throw $e; | |
} | |
} |
rklak
commented
Oct 18, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment