diff --git a/tests/Unit/Handler/FooterHandlerTest.php b/tests/Unit/Handler/FooterHandlerTest.php index ab65f1ed88..56c115b198 100644 --- a/tests/Unit/Handler/FooterHandlerTest.php +++ b/tests/Unit/Handler/FooterHandlerTest.php @@ -21,13 +21,13 @@ final class FooterHandlerTest extends \OCA\Libresign\Tests\Unit\TestCase { private PdfParserService&MockObject $pdfParserService; private IURLGenerator&MockObject $urlGenerator; private IL10N&MockObject $l10n; - private ITempManager&MockObject $tempManager; + private ITempManager $tempManager; private FooterHandler $footerHandler; public function setUp(): void { $this->appConfig = $this->getMockAppConfig(); $this->pdfParserService = $this->createMock(PdfParserService::class); $this->urlGenerator = $this->createMock(IURLGenerator::class); - $this->tempManager = $this->createMock(ITempManager::class); + $this->tempManager = \OCP\Server::get(ITempManager::class); $this->l10n = $this->createMock(IL10N::class); $this->l10n @@ -47,7 +47,7 @@ private function getClass(): FooterHandler { } public function testGetFooterWithoutValidationSite(): void { - $this->appConfig->setValueBool(Application::APP_ID, 'add_footer', true); + $this->appConfig->setValueBool(Application::APP_ID, 'add_footer', false); $file = $this->createMock(\OCP\Files\File::class); $libresignFile = $this->createMock(\OCA\Libresign\Db\File::class); $actual = $this->getClass()->getFooter($file, $libresignFile); diff --git a/tests/lib/AppConfigOverwrite.php b/tests/lib/AppConfigOverwrite.php index a09c42eb48..8178eac9ae 100644 --- a/tests/lib/AppConfigOverwrite.php +++ b/tests/lib/AppConfigOverwrite.php @@ -74,4 +74,19 @@ public function getValueBool(string $app, string $key, bool $default = false, bo return parent::getValueBool($app, $key, $default); } + + public function getValueString(string $app, string $key, string $default = '', bool $lazy = false): string + { + if (isset($this->overWrite[$app]) && isset($this->overWrite[$app][$key])) { + return $this->overWrite[$app][$key]; + } + + return parent::getValueString($app, $key, $default); + } + + public function setValueString(string $app, string $key, string $value, bool $lazy = false, bool $sensitive = false): bool + { + $this->overWrite[$app][$key] = $value; + return true; + } }