Test Timeout
Control runaway async code by ensuring that tests complete within a giving time period using the #[Timeout] Attribute!
<?php
use Cspray\Labrador\AsyncUnit\TestCase;
use Cspray\Labrador\AsyncUnit\Attribute\Test;
use Cspray\Labrador\AsyncUnit\Attribute\Timeout;
class MyExceptionTestCase extends TestCase {
#[Test]
#[Timeout(100);
public function checkExceptionThrown() {
yield new Delayed(150);
yield $this->asyncAssert()->floatEquals(3.14, 3.14);
}
}Last updated
Was this helpful?