Skip to content

Commit

Permalink
refactor: avoid using vfsStream in CryptTest class
Browse files Browse the repository at this point in the history
  • Loading branch information
brotkrueml committed Aug 21, 2024
1 parent 6bd39a7 commit 5da3b0a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Tests/Unit/Service/CryptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
{
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5da3b0a

Please sign in to comment.