Skip to content

Commit 5c17f68

Browse files
committed
test: add NoOpSecretStoreTest
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent dcb024f commit 5c17f68

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
// SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
4+
// SPDX-License-Identifier: AGPL-3.0-or-later
5+
6+
declare(strict_types=1);
7+
8+
namespace LibreCodeCoop\NfsePHP\Tests\Unit\SecretStore;
9+
10+
use LibreCodeCoop\NfsePHP\SecretStore\NoOpSecretStore;
11+
use LibreCodeCoop\NfsePHP\Tests\TestCase;
12+
13+
/**
14+
* @covers \LibreCodeCoop\NfsePHP\SecretStore\NoOpSecretStore
15+
*/
16+
class NoOpSecretStoreTest extends TestCase
17+
{
18+
private NoOpSecretStore $store;
19+
20+
protected function setUp(): void
21+
{
22+
$this->store = new NoOpSecretStore();
23+
}
24+
25+
public function testGetReturnsEmptyArrayWhenPathNotSet(): void
26+
{
27+
self::assertSame([], $this->store->get('pfx/unknown'));
28+
}
29+
30+
public function testPutAndGetRoundtrip(): void
31+
{
32+
$this->store->put('pfx/12345678000100', ['password' => 'secret123']);
33+
34+
self::assertSame(['password' => 'secret123'], $this->store->get('pfx/12345678000100'));
35+
}
36+
37+
public function testDeleteRemovesSecret(): void
38+
{
39+
$this->store->put('pfx/12345678000100', ['password' => 'secret123']);
40+
$this->store->delete('pfx/12345678000100');
41+
42+
self::assertSame([], $this->store->get('pfx/12345678000100'));
43+
}
44+
45+
public function testMultiplePathsAreIndependent(): void
46+
{
47+
$this->store->put('pfx/11111111000100', ['password' => 'aaa']);
48+
$this->store->put('pfx/22222222000100', ['password' => 'bbb']);
49+
50+
self::assertSame('aaa', $this->store->get('pfx/11111111000100')['password']);
51+
self::assertSame('bbb', $this->store->get('pfx/22222222000100')['password']);
52+
}
53+
}

0 commit comments

Comments
 (0)