feat: improvements

This commit is contained in:
loks0n
2024-08-15 11:36:50 +01:00
parent ec57f0a30a
commit 7fe90b58c8
2 changed files with 9 additions and 6 deletions
+6 -3
View File
@@ -2,13 +2,16 @@
namespace Appwrite\Tests;
use PHPUnit\Framework\Assert;
use Appwrite\Tests\Async\Eventually;
use PHPUnit\Framework\Assert;
const DEFAULT_TIMEOUT_MS = 10000;
const DEFAULT_WAIT_MS = 500;
trait Async
{
public static function assertEventually(callable $probe, int $timeoutMilliseconds = 10000, int $waitMilliseconds = 500): void
public static function assertEventually(callable $probe, int $timeoutMs = DEFAULT_TIMEOUT_MS, int $waitMs = DEFAULT_WAIT_MS): void
{
Assert::assertThat($probe, new Eventually($timeoutMilliseconds, $waitMilliseconds));
Assert::assertThat($probe, new Eventually($timeoutMs, $waitMs));
}
}
+3 -3
View File
@@ -9,7 +9,7 @@ final class Eventually extends Constraint
private int $timeoutMs;
private int $waitMs;
public function __construct(int $timeoutMs = 10000, int $waitMs = 500)
public function __construct(int $timeoutMs, int $waitMs)
{
$this->timeoutMs = $timeoutMs;
$this->waitMs = $waitMs;
@@ -44,11 +44,11 @@ final class Eventually extends Constraint
protected function failureDescription(mixed $other): string
{
return 'the given probe was satisfied within the provided timeout';
return 'the given probe was satisfied within ' . $this->timeoutMs . 'ms.';
}
public function toString(): string
{
return 'Eventually';
}
}
}