. */ namespace SP\Test\Services\Crypt; use Defuse\Crypto\Key; use PHPUnit\Framework\TestCase; use SP\Core\Crypt\UUIDCookie; use SP\Services\Crypt\SecureSessionService; use function SP\Test\setupContext; /** * Class SecureSessionServiceTest * * @package SP\Tests\Services\Crypt */ class SecureSessionServiceTest extends TestCase { /** * @throws \DI\DependencyException * @throws \DI\NotFoundException * @throws \SP\Core\Context\ContextException */ public function testGetKey() { $dic = setupContext(); $service = $dic->get(SecureSessionService::class); $stub = $this->createMock(UUIDCookie::class); $stub->method('loadCookie') ->willReturn(uniqid('', true)); $stub->method('createCookie') ->willReturn(uniqid('', true)); $this->assertInstanceOf(Key::class, $service->getKey($stub)); $this->assertFileExists($service->getFilename()); } }