TestCase Hooks
Hooks provide robust functionality to perform operations around each test. Provides equivalent of PHPUnit's setUp and tearDown methods... with full asynchronous support.
Setup for each test
<?php
use Cspray\Labrador\AsyncUnit\Attribute\BeforeEach;
use Cspray\Labrador\AsyncUnit\Attribute\Test;
use Cspray\Labrador\AsyncUnit\Attribute\AfterEach;
class MyTestCase extends TestCase {
private string $bestFramework;
#[BeforeEach]
public function setUp() {
$this->bestFramework = 'AsyncUnit';
}
#[Test]
public function whosTheBest() {
$this->assert()->stringEquals('AsyncUnit', $this->bestFramework);
}
#[AfterEach]
public function tearDown() {
$this->bestFramework = null;
}
}TestCase wide setup and tear down
Last updated
Was this helpful?