Created
March 1, 2021 17:03
-
-
Save jasonvarga/065daa7966bb560c47a6b08dc9ece789 to your computer and use it in GitHub Desktop.
PHPUnit Test Hooks Extension
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 | |
namespace Tests; | |
use PHPUnit\Runner\AfterLastTestHook; | |
use PHPUnit\Runner\BeforeFirstTestHook; | |
use PHPUnit\Runner\BeforeTestHook; | |
class Hooks implements BeforeFirstTestHook, AfterLastTestHook, BeforeTestHook | |
{ | |
public function executeBeforeFirstTest(): void | |
{ | |
ray()->clearAll(); | |
} | |
public function executeBeforeTest(string $test): void | |
{ | |
ray($test)->blue(); | |
} | |
public function executeAfterLastTest(): void | |
{ | |
ray('Done')->blue(); | |
} | |
} |
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
<extensions> | |
<extension class="Tests\Hooks" /> | |
</extensions> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment