From 5da3b0a7e11d8a6cf91430d2f694900b4d11fd63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20M=C3=BCller?= <2566282+brotkrueml@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:08:47 +0200 Subject: [PATCH] refactor: avoid using vfsStream in CryptTest class --- Tests/Unit/Service/CryptTest.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Tests/Unit/Service/CryptTest.php b/Tests/Unit/Service/CryptTest.php index d34476f..f276aec 100644 --- a/Tests/Unit/Service/CryptTest.php +++ b/Tests/Unit/Service/CryptTest.php @@ -14,7 +14,6 @@ use JobRouter\AddOn\Typo3Connector\Exception\CryptException; use JobRouter\AddOn\Typo3Connector\Service\Crypt; use JobRouter\AddOn\Typo3Connector\Service\FileService; -use org\bovigo\vfs\vfsStream; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; @@ -24,11 +23,6 @@ final class CryptTest extends TestCase { private ?Crypt $subject = null; - protected function setUp(): void - { - vfsStream::setup('project-dir'); - } - #[Test] public function generateKeyReturnsAKey(): void { @@ -90,7 +84,11 @@ public function decryptThrowsExceptionOnDecryptionFailure(): void protected function initialiseSubjectWithKeyPath(bool $fileShouldExist = true): void { - $keyPath = vfsStream::url('project-dir') . '/.jobrouter-key'; + if ($fileShouldExist) { + $keyPath = \tempnam(\sys_get_temp_dir(), 'crypttest-'); + } else { + $keyPath = \sys_get_temp_dir() . '/non-existing-' . \uniqid(); + } $fileServiceMock = $this->createMock(FileService::class); $fileServiceMock