Merge pull request #24288 from nextcloud/techdebt/noid/encryption-setup-dependency-cleanup

Remove unused dependencies in encryption app setup
This commit is contained in:
Morris Jobke 2020-11-23 20:43:42 +01:00 committed by GitHub
commit dc5f17f561
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 38 deletions

View File

@ -29,40 +29,15 @@ namespace OCA\Encryption\Users;
use OCA\Encryption\Crypto\Crypt;
use OCA\Encryption\KeyManager;
use OCP\ILogger;
use OCP\IUserSession;
class Setup {
/**
* @var Crypt
*/
/** @var Crypt */
private $crypt;
/**
* @var KeyManager
*/
/** @var KeyManager */
private $keyManager;
/**
* @var ILogger
*/
private $logger;
/**
* @var bool|string
*/
private $user;
/**
* @param ILogger $logger
* @param IUserSession $userSession
* @param Crypt $crypt
* @param KeyManager $keyManager
*/
public function __construct(ILogger $logger,
IUserSession $userSession,
Crypt $crypt,
public function __construct(Crypt $crypt,
KeyManager $keyManager) {
$this->logger = $logger;
$this->user = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
$this->crypt = $crypt;
$this->keyManager = $keyManager;
}

View File

@ -30,8 +30,6 @@ namespace OCA\Encryption\Tests\Users;
use OCA\Encryption\Crypto\Crypt;
use OCA\Encryption\KeyManager;
use OCA\Encryption\Users\Setup;
use OCP\ILogger;
use OCP\IUserSession;
use Test\TestCase;
class SetupTest extends TestCase {
@ -50,10 +48,6 @@ class SetupTest extends TestCase {
protected function setUp(): void {
parent::setUp();
$logMock = $this->createMock(ILogger::class);
$userSessionMock = $this->getMockBuilder(IUserSession::class)
->disableOriginalConstructor()
->getMock();
$this->cryptMock = $this->getMockBuilder(Crypt::class)
->disableOriginalConstructor()
->getMock();
@ -62,10 +56,7 @@ class SetupTest extends TestCase {
->disableOriginalConstructor()
->getMock();
/** @var \OCP\ILogger $logMock */
/** @var \OCP\IUserSession $userSessionMock */
$this->instance = new Setup($logMock,
$userSessionMock,
$this->instance = new Setup(
$this->cryptMock,
$this->keyManagerMock);
}