diff --git a/tests/unit/Platform/Workers/ExecutionsTest.php b/tests/unit/Platform/Workers/ExecutionsTest.php index 21757d6aa6..4603dd027d 100644 --- a/tests/unit/Platform/Workers/ExecutionsTest.php +++ b/tests/unit/Platform/Workers/ExecutionsTest.php @@ -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(