|
9 | 9 | namespace OCA\Libresign\Tests\Unit\Settings; |
10 | 10 |
|
11 | 11 | use OCA\Libresign\AppInfo\Application; |
12 | | -use OCA\Libresign\Handler\CertificateEngine\AEngineHandler; |
13 | 12 | use OCA\Libresign\Handler\CertificateEngine\CertificateEngineFactory; |
14 | 13 | use OCA\Libresign\Service\AccountService; |
15 | 14 | use OCA\Libresign\Service\CertificatePolicyService; |
|
20 | 19 | use OCA\Libresign\Service\SignatureBackgroundService; |
21 | 20 | use OCA\Libresign\Service\SignatureTextService; |
22 | 21 | use OCA\Libresign\Settings\Admin; |
23 | | -use OCP\AppFramework\Http\TemplateResponse; |
24 | 22 | use OCP\AppFramework\Services\IInitialState; |
25 | 23 | use OCP\IAppConfig; |
26 | | -use OCP\IUser; |
27 | 24 | use OCP\IUserSession; |
28 | 25 | use PHPUnit\Framework\MockObject\MockObject; |
29 | 26 |
|
@@ -80,113 +77,4 @@ public function testGetSessionReturningAppId():void { |
80 | 77 | public function testGetPriority():void { |
81 | 78 | $this->assertEquals($this->admin->getPriority(), 100); |
82 | 79 | } |
83 | | - |
84 | | - public function testGetFormProvidesUserConfigInitialState(): void { |
85 | | - $user = $this->createMock(IUser::class); |
86 | | - $engine = $this->getMockBuilder(AEngineHandler::class) |
87 | | - ->disableOriginalConstructor() |
88 | | - ->onlyMethods(['getName']) |
89 | | - ->getMockForAbstractClass(); |
90 | | - $providedState = []; |
91 | | - |
92 | | - $this->userSession |
93 | | - ->method('getUser') |
94 | | - ->willReturn($user); |
95 | | - $this->accountService |
96 | | - ->expects($this->once()) |
97 | | - ->method('getConfig') |
98 | | - ->with($user) |
99 | | - ->willReturn(['policy_workbench_catalog_compact_view' => true]); |
100 | | - $this->initialState |
101 | | - ->method('provideInitialState') |
102 | | - ->willReturnCallback(function (string $key, mixed $value) use (&$providedState): void { |
103 | | - $providedState[$key] = $value; |
104 | | - }); |
105 | | - $this->signatureTextService |
106 | | - ->method('parse') |
107 | | - ->willReturn(['parsed' => '']); |
108 | | - $engine |
109 | | - ->method('getName') |
110 | | - ->willReturn('OpenSsl'); |
111 | | - $this->certificateEngineFactory |
112 | | - ->method('getEngine') |
113 | | - ->willReturn($engine); |
114 | | - $this->certificatePolicyService |
115 | | - ->method('getOid') |
116 | | - ->willReturn(''); |
117 | | - $this->certificatePolicyService |
118 | | - ->method('getCps') |
119 | | - ->willReturn(''); |
120 | | - $this->appConfig |
121 | | - ->method('getValueString') |
122 | | - ->willReturnCallback(static fn (string $appId, string $key, string $default = ''): string => $default); |
123 | | - $this->appConfig |
124 | | - ->method('getValueFloat') |
125 | | - ->willReturnCallback(static fn (string $appId, string $key, float $default = 0.0): float => $default); |
126 | | - $this->appConfig |
127 | | - ->method('getValueInt') |
128 | | - ->willReturnCallback(static fn (string $appId, string $key, int $default = 0): int => $default); |
129 | | - $this->appConfig |
130 | | - ->method('getValueBool') |
131 | | - ->willReturnCallback(static fn (string $appId, string $key, bool $default = false): bool => $default); |
132 | | - $this->appConfig |
133 | | - ->method('getValueArray') |
134 | | - ->willReturnCallback(static fn (string $appId, string $key, array $default = []): array => $default); |
135 | | - $this->signatureTextService |
136 | | - ->method('getDefaultTemplate') |
137 | | - ->willReturn(''); |
138 | | - $this->signatureTextService |
139 | | - ->method('getDefaultTemplateFontSize') |
140 | | - ->willReturn(12.0); |
141 | | - $this->identifyMethodService |
142 | | - ->method('getIdentifyMethodsSettings') |
143 | | - ->willReturn([]); |
144 | | - $this->signatureTextService |
145 | | - ->method('getAvailableVariables') |
146 | | - ->willReturn([]); |
147 | | - $this->signatureBackgroundService |
148 | | - ->method('getSignatureBackgroundType') |
149 | | - ->willReturn('none'); |
150 | | - $this->signatureTextService |
151 | | - ->method('getSignatureFontSize') |
152 | | - ->willReturn(12.0); |
153 | | - $this->signatureTextService |
154 | | - ->method('getFullSignatureHeight') |
155 | | - ->willReturn(100.0); |
156 | | - $this->footerService |
157 | | - ->method('getTemplateVariablesMetadata') |
158 | | - ->willReturn([]); |
159 | | - $this->footerService |
160 | | - ->method('getTemplate') |
161 | | - ->willReturn(''); |
162 | | - $this->footerService |
163 | | - ->method('isDefaultTemplate') |
164 | | - ->willReturn(true); |
165 | | - $this->signatureTextService |
166 | | - ->method('getRenderMode') |
167 | | - ->willReturn('text'); |
168 | | - $this->signatureTextService |
169 | | - ->method('getTemplate') |
170 | | - ->willReturn(''); |
171 | | - $this->signatureTextService |
172 | | - ->method('getFullSignatureWidth') |
173 | | - ->willReturn(100.0); |
174 | | - $this->signatureTextService |
175 | | - ->method('getTemplateFontSize') |
176 | | - ->willReturn(12.0); |
177 | | - $this->docMdpConfigService |
178 | | - ->method('getConfig') |
179 | | - ->willReturn([]); |
180 | | - $this->policyService |
181 | | - ->method('resolveKnownPolicies') |
182 | | - ->willReturn([]); |
183 | | - |
184 | | - $response = $this->admin->getForm(); |
185 | | - |
186 | | - $this->assertInstanceOf(TemplateResponse::class, $response); |
187 | | - $this->assertSame( |
188 | | - ['policy_workbench_catalog_compact_view' => true], |
189 | | - $providedState['config'] ?? null, |
190 | | - ); |
191 | | - } |
192 | 80 | } |
0 commit comments