mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Fix unit tests
This commit is contained in:
1 parent
0ac78566bd
commit
10d8c6bd4e
1 file changed
+15
-7
@@ -28,7 +28,7 @@ final class ExecutionsTest extends TestCase
|
||||
$created = $execution;
|
||||
return $execution;
|
||||
});
|
||||
$dbForProject->expects($this->never())->method('upsertDocument');
|
||||
$dbForProject->expects($this->never())->method('upsertDocuments');
|
||||
|
||||
(new Executions())->action(
|
||||
$this->message((new Execution(
|
||||
@@ -48,7 +48,7 @@ final class ExecutionsTest extends TestCase
|
||||
$dbForProject->expects($this->once())
|
||||
->method('createDocument')
|
||||
->willThrowException(new Duplicate('Execution already exists'));
|
||||
$dbForProject->expects($this->never())->method('upsertDocument');
|
||||
$dbForProject->expects($this->never())->method('upsertDocuments');
|
||||
|
||||
(new Executions())->action(
|
||||
$this->message((new Execution(
|
||||
@@ -65,11 +65,19 @@ final class ExecutionsTest extends TestCase
|
||||
$dbForProject = $this->createMock(Database::class);
|
||||
$dbForProject->expects($this->never())->method('createDocument');
|
||||
$dbForProject->expects($this->once())
|
||||
->method('upsertDocument')
|
||||
->with('executions', $this->isInstanceOf(Document::class))
|
||||
->willReturnCallback(function (string $collection, Document $execution) use (&$upserted): Document {
|
||||
$upserted = $execution;
|
||||
return $execution;
|
||||
->method('upsertDocuments')
|
||||
->with('executions', $this->isArray())
|
||||
->willReturnCallback(function (
|
||||
string $collection,
|
||||
array $executions,
|
||||
int $batchSize = 0,
|
||||
?callable $onNext = null,
|
||||
?callable $onError = null
|
||||
) use (&$upserted): int {
|
||||
// No callback is passed, so the write skips the sequence fetch.
|
||||
$this->assertNull($onNext);
|
||||
$upserted = $executions[0];
|
||||
return \count($executions);
|
||||
});
|
||||
|
||||
(new Executions())->action(
|
||||
|
||||
Reference in new issue
Block a user