mirror of
https://github.com/LibreSign/libresign.git
synced 2025-12-18 05:20:45 +01:00
test: fix mock callbacks for testUpdateDatabaseWhenSign and testDispatchEventWhenSign
Add __call callbacks to SignRequest mocks in both tests to properly return fileId and signingOrder values. Without these callbacks, the mocks were returning null when these magic methods were called, causing SequentialSigningService::releaseNextOrder() to fail with a TypeError. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
This commit is contained in:
parent
6502530576
commit
fae11f133c
1 changed files with 18 additions and 0 deletions
|
|
@ -340,6 +340,15 @@ final class SignFileServiceTest extends \OCA\Libresign\Tests\Unit\TestCase {
|
|||
$this->signRequestMapper->expects($this->once())->method('update');
|
||||
|
||||
$signRequest = $this->createMock(SignRequest::class);
|
||||
$signRequest->method('__call')->willReturnCallback(function ($method, $args) {
|
||||
switch ($method) {
|
||||
case 'getFileId':
|
||||
return 1;
|
||||
case 'getSigningOrder':
|
||||
return 1;
|
||||
default: return null;
|
||||
}
|
||||
});
|
||||
$libreSignFile = $this->createMock(\OCA\Libresign\Db\File::class);
|
||||
|
||||
$service
|
||||
|
|
@ -366,6 +375,15 @@ final class SignFileServiceTest extends \OCA\Libresign\Tests\Unit\TestCase {
|
|||
->with($this->isInstanceOf(SignedEvent::class));
|
||||
|
||||
$signRequest = $this->createMock(SignRequest::class);
|
||||
$signRequest->method('__call')->willReturnCallback(function ($method, $args) {
|
||||
switch ($method) {
|
||||
case 'getFileId':
|
||||
return 1;
|
||||
case 'getSigningOrder':
|
||||
return 1;
|
||||
default: return null;
|
||||
}
|
||||
});
|
||||
$libreSignFile = $this->createMock(\OCA\Libresign\Db\File::class);
|
||||
|
||||
$service
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue