Skip to content

Commit f80040d

Browse files
committed
test: drop brittle admin initial state unit test
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 0e688c6 commit f80040d

1 file changed

Lines changed: 0 additions & 112 deletions

File tree

tests/php/Unit/Settings/AdminTest.php

Lines changed: 0 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
namespace OCA\Libresign\Tests\Unit\Settings;
1010

1111
use OCA\Libresign\AppInfo\Application;
12-
use OCA\Libresign\Handler\CertificateEngine\AEngineHandler;
1312
use OCA\Libresign\Handler\CertificateEngine\CertificateEngineFactory;
1413
use OCA\Libresign\Service\AccountService;
1514
use OCA\Libresign\Service\CertificatePolicyService;
@@ -20,10 +19,8 @@
2019
use OCA\Libresign\Service\SignatureBackgroundService;
2120
use OCA\Libresign\Service\SignatureTextService;
2221
use OCA\Libresign\Settings\Admin;
23-
use OCP\AppFramework\Http\TemplateResponse;
2422
use OCP\AppFramework\Services\IInitialState;
2523
use OCP\IAppConfig;
26-
use OCP\IUser;
2724
use OCP\IUserSession;
2825
use PHPUnit\Framework\MockObject\MockObject;
2926

@@ -80,113 +77,4 @@ public function testGetSessionReturningAppId():void {
8077
public function testGetPriority():void {
8178
$this->assertEquals($this->admin->getPriority(), 100);
8279
}
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-
}
19280
}

0 commit comments

Comments
 (0)