File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99use Symfony \Component \Console \Output \BufferedOutput ;
1010use Symfony \Component \Console \Output \NullOutput ;
1111use Symfony \Component \Filesystem \Filesystem ;
12- use Symfony \Component \Finder \Finder ;
1312
1413class EncryptionGenerateKeysCommandTest extends KernelTestCase
1514{
16- private string $ privateKeyPath = __DIR__ . ' /keys/private.key ' ;
17- private string $ publicKeyPath = __DIR__ . ' /keys/public.key ' ;
18-
15+ private string $ storagePath ;
16+ private string $ privateKeyPath ;
17+ private string $ publicKeyPath ;
1918 private Filesystem $ filesystem ;
2019
20+ #[\Override]
2121 protected function setUp (): void
2222 {
23+ $ this ->storagePath = sys_get_temp_dir () . '/dirigent-encryption-keys- ' . uniqid ();
24+ $ this ->privateKeyPath = "$ this ->storagePath /private.key " ;
25+ $ this ->publicKeyPath = "$ this ->storagePath /public.key " ;
2326 $ this ->filesystem = new Filesystem ();
24-
25- $ this ->clearKeys ();
2627 }
2728
2829 #[\Override]
2930 protected function tearDown (): void
3031 {
31- $ this ->clearKeys ();
32- }
33-
34- private function clearKeys (): void
35- {
36- $ files = Finder::create ()
37- ->files ()
38- ->in (__DIR__ . '/keys ' )
39- ->name ('*.key ' );
40-
41- foreach ($ files as $ file ) {
42- $ this ->filesystem ->remove ($ file ->getRealPath ());
43- }
32+ (new Filesystem ())->remove ($ this ->storagePath );
4433 }
4534
4635 public function testGenerateNewKeys (): void
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments