diff --git a/tests/extensions/Async.php b/tests/extensions/Async.php index 0fb9c8eea6..48af24bc02 100644 --- a/tests/extensions/Async.php +++ b/tests/extensions/Async.php @@ -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)); } } diff --git a/tests/extensions/Async/Eventually.php b/tests/extensions/Async/Eventually.php index 0a903b3280..e4987de410 100644 --- a/tests/extensions/Async/Eventually.php +++ b/tests/extensions/Async/Eventually.php @@ -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'; } -} \ No newline at end of file +}