mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
feat: improvements
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user