This commit is contained in:
James 2019-09-19 09:38:01 +01:00
parent 68edd0f3ea
commit 428e843ac8
2 changed files with 30 additions and 0 deletions

19
src/Extention.php Normal file
View File

@ -0,0 +1,19 @@
<?php declare(strict_types=1);
namespace JHodges\GiteaBitPHPUnit;
use PHPUnit\Runner\BeforeFirstTestHook;
use PHPUnit\Runner\AfterLastTestHook;
final class Extension implements BeforeFirstTestHook, AfterLastTestHook{
public function executeBeforeFirstTest(): void
{
// called before the first test is being run
echo "AAAAAA";
}
public function executeAfterLastTest(): void
{
echo "ZZZZZZZ";
// called after the last test has been run
}
}

View File

@ -3,9 +3,20 @@ namespace JHodges\GiteaBitPHPUnit;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\TestListener; use PHPUnit\Framework\TestListener;
use PHPUnit\Framework\Test as PHPUnit_Framework_Test;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\AssertionFailedError as PHPUnit_Framework_AssertionFailedError;
use PHPUnit\Framework\TestSuite as PHPUnit_Framework_TestSuite;
use PHPUnit\Framework\Warning;
use Exception;
class Listener implements TestListener{ class Listener implements TestListener{
public function addWarning(Test $test, Warning $e, $time)
{
printf("Warning while running test '%s'.\n", $test->getName());
}
public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
{ {
printf("Error while running test '%s'.\n", $test->getName()); printf("Error while running test '%s'.\n", $test->getName());