99 * SPDX-License-Identifier: AGPL-3.0-or-later
1010 */
1111
12+ use OCA \Libresign \AppInfo \Application ;
1213use OCA \Libresign \Capabilities ;
1314use OCA \Libresign \Service \Envelope \EnvelopeService ;
1415use OCA \Libresign \Service \SignatureTextService ;
1516use OCA \Libresign \Service \SignerElementsService ;
1617use OCP \App \IAppManager ;
18+ use OCP \IAppConfig ;
1719use PHPUnit \Framework \Attributes \DataProvider ;
1820use PHPUnit \Framework \MockObject \MockObject ;
1921
@@ -23,12 +25,14 @@ final class CapabilitiesTest extends \OCA\Libresign\Tests\Unit\TestCase {
2325 private SignatureTextService &MockObject $ signatureTextService ;
2426 private IAppManager &MockObject $ appManager ;
2527 private EnvelopeService &MockObject $ envelopeService ;
28+ private IAppConfig &MockObject $ appConfig ;
2629
2730 public function setUp (): void {
2831 $ this ->signerElementsService = $ this ->createMock (SignerElementsService::class);
2932 $ this ->signatureTextService = $ this ->createMock (SignatureTextService::class);
3033 $ this ->appManager = $ this ->createMock (IAppManager::class);
3134 $ this ->envelopeService = $ this ->createMock (EnvelopeService::class);
35+ $ this ->appConfig = $ this ->createMock (IAppConfig::class);
3236 }
3337
3438
@@ -38,6 +42,7 @@ private function getClass(): Capabilities {
3842 $ this ->signatureTextService ,
3943 $ this ->appManager ,
4044 $ this ->envelopeService ,
45+ $ this ->appConfig ,
4146 );
4247 return $ this ->capabilities ;
4348 }
@@ -55,4 +60,20 @@ public static function providerSignElementsIsAvailable(): array {
5560 [false , false ],
5661 ];
5762 }
63+
64+ #[DataProvider('providerShowConfetti ' )]
65+ public function testShowConfetti (bool $ configValue , bool $ expected ): void {
66+ $ this ->appConfig ->method ('getValueBool ' )
67+ ->with (Application::APP_ID , 'show_confetti_after_signing ' , true )
68+ ->willReturn ($ configValue );
69+ $ capabilities = $ this ->getClass ()->getCapabilities ();
70+ $ this ->assertEquals ($ expected , $ capabilities ['libresign ' ]['config ' ]['show-confetti ' ]);
71+ }
72+
73+ public static function providerShowConfetti (): array {
74+ return [
75+ [true , true ],
76+ [false , false ],
77+ ];
78+ }
5879}
0 commit comments