mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
test(Session): lint/rector cleanup of CryptoWrappingTest
Signed-off-by: Josh <josh.t.richards@gmail.com>
This commit is contained in:
parent
971b0e32d5
commit
f8756b1ef4
1 changed files with 6 additions and 6 deletions
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
namespace Test\Session;
|
||||
|
||||
use OC\Session\CryptoWrapper;
|
||||
use OC\Session\CryptoSessionData;
|
||||
use OC\Session\CryptoWrapper;
|
||||
use OC\Session\Memory;
|
||||
use OCP\IRequest;
|
||||
use OCP\Security\ICrypto;
|
||||
|
|
@ -38,7 +38,7 @@ class CryptoWrappingTest extends TestCase {
|
|||
private const COOKIE_PASSPHRASE = 'cookiePassphrase';
|
||||
private const GENERATED_PASSPHRASE = 'generatedPassphrase';
|
||||
private const SERVER_PROTOCOL = 'https';
|
||||
|
||||
|
||||
protected ICrypto|MockObject $crypto;
|
||||
protected ISecureRandom|MockObject $random;
|
||||
protected IRequest|MockObject $request;
|
||||
|
|
@ -134,10 +134,10 @@ class CryptoWrappingTest extends TestCase {
|
|||
$expectedPassphrase = str_pad(self::GENERATED_PASSPHRASE, 128, '_' . __FUNCTION__, STR_PAD_RIGHT);
|
||||
|
||||
$this->crypto->method('encrypt')->willReturnCallback(
|
||||
fn($input) => '#' . $input . '#'
|
||||
fn ($input) => '#' . $input . '#'
|
||||
);
|
||||
$this->crypto->method('decrypt')->willReturnCallback(
|
||||
fn($input) => ($input === '' || strlen($input) < 2) ? '' : substr($input, 1, -1)
|
||||
fn ($input) => ($input === '' || strlen($input) < 2) ? '' : substr($input, 1, -1)
|
||||
);
|
||||
|
||||
$this->random->method('generate')->with(128)->willReturn($expectedPassphrase);
|
||||
|
|
@ -145,9 +145,9 @@ class CryptoWrappingTest extends TestCase {
|
|||
$this->request->method('getServerProtocol')->willReturn(self::SERVER_PROTOCOL);
|
||||
|
||||
$session = new Memory();
|
||||
$cryptoWrapper = new CryptoWrapper($this->crypto, $this->random, $this->request);
|
||||
$cryptoWrapper = new CryptoWrapper($this->crypto, $this->random, $this->request);
|
||||
$wrappedSession = $cryptoWrapper->wrapSession($session);
|
||||
|
||||
|
||||
$wrappedSession->set($keyName, $unencryptedValue);
|
||||
$wrappedSession->close();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue