Skip to content

Instantly share code, notes, and snippets.

@atlance
Forked from jasonvarga/Hooks.php
Created February 13, 2024 07:02
Show Gist options
  • Select an option

  • Save atlance/456a42e2895901e19146c84b40aa5d11 to your computer and use it in GitHub Desktop.

Select an option

Save atlance/456a42e2895901e19146c84b40aa5d11 to your computer and use it in GitHub Desktop.
PHPUnit Test Hooks Extension
<?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();
}
}
<extensions>
<extension class="Tests\Hooks" />
</extensions>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment