Skip to content

Commit 76cb1db

Browse files
committed
test: inject URL generator in JSignPdfHandler test
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent b4b073c commit 76cb1db

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tests/php/Unit/Handler/SignEngine/JSignPdfHandlerTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use OCP\IDateTimeZone;
2727
use OCP\IRequest;
2828
use OCP\ITempManager;
29+
use OCP\IURLGenerator;
2930
use OCP\IUserSession;
3031
use OCP\L10N\IFactory as IL10NFactory;
3132
use PHPUnit\Framework\Attributes\DataProvider;
@@ -74,12 +75,18 @@ public function setUp(): void {
7475
}
7576

7677
private function getInstance(array $methods = []): JSignPdfHandler|MockObject {
78+
$urlGenerator = $this->createMock(IURLGenerator::class);
79+
$urlGenerator
80+
->method('linkToRouteAbsolute')
81+
->willReturnCallback(fn (string $route, array $params): string => 'https://example.test/' . $route . '/' . ($params['uuid'] ?? ''));
82+
7783
$signatureTextService = new SignatureTextService(
7884
$this->appConfig,
7985
\OCP\Server::get(IL10NFactory::class)->get(Application::APP_ID),
8086
\OCP\Server::get(IDateTimeZone::class),
8187
\OCP\Server::get(IRequest::class),
8288
\OCP\Server::get(IUserSession::class),
89+
$urlGenerator,
8390
\OCP\Server::get(LoggerInterface::class),
8491
);
8592

0 commit comments

Comments
 (0)