Skip to content

Commit be3d5bb

Browse files
authored
Merge pull request #27 from LibreCodeCoop/test/edit-certificate-state-absent-scenario
test: cover edit empty certificate state
2 parents 1d3436d + fe9b5f2 commit be3d5bb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/Unit/Http/Controllers/SettingsControllerTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ public function testEditReturnsSettingsAndCertificateStateIncludingLocalCertific
5252
self::assertTrue($response->data['certificateState']['has_saved_settings'] ?? false);
5353
}
5454

55+
public function testEditReturnsEmptyCertificateStateWhenNoSavedCnpjExists(): void
56+
{
57+
ControllerIsolationState::reset();
58+
59+
$response = (new SettingsController())->edit();
60+
61+
self::assertSame('nfse::settings.edit', $response->name);
62+
self::assertSame([], $response->data['settings'] ?? []);
63+
self::assertSame('', $response->data['certificateState']['cnpj'] ?? null);
64+
self::assertSame('', $response->data['certificateState']['local_path'] ?? null);
65+
self::assertFalse($response->data['certificateState']['has_local_certificate'] ?? true);
66+
self::assertFalse($response->data['certificateState']['has_saved_settings'] ?? true);
67+
}
68+
5569
public function testPrepareNfseInputNormalizesFieldsAndPreservesExistingSecretsWithoutCertificateReplacement(): void
5670
{
5771
$controller = new class () extends SettingsController {

0 commit comments

Comments
 (0)