Created
March 8, 2023 05:44
-
-
Save fomigo/ca2285050383017bcfa091b7dbde150a to your computer and use it in GitHub Desktop.
Hamcrest Test Case for PHPUnit
This file contains hidden or 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 // test/HamcrestTestCase.php | |
namespace App\Test; | |
use PHPUnit\Framework\TestCase; | |
use Hamcrest\MatcherAssert; | |
use Hamcrest\Util; | |
class HamcrestTestCase extends TestCase { | |
public function runBare(): void { | |
Util::registerGlobalFunctions(); | |
MatcherAssert::resetCount(); | |
try { | |
parent::runBare(); | |
} finally { | |
$this->addToAssertionCount(MatcherAssert::getCount()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment