aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-09-29 16:38:29 +0200
committerJoas Schilling <coding@schilljs.com>2016-09-30 10:00:26 +0200
commit877cb06bfed4524beb62e4cc52f946406ef7d5ea (patch)
tree03a82caf3fda2285a7d25da5f8c64fa6a6930527 /tests
parent99076a8c0d1ab4b8666ab6adb859c47caaa9c7a2 (diff)
downloadnextcloud-server-877cb06bfed4524beb62e4cc52f946406ef7d5ea.tar.gz
nextcloud-server-877cb06bfed4524beb62e4cc52f946406ef7d5ea.zip
Use magic DI for core controllers
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/Core/Controller/LostControllerTest.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php
index 2e7d6721d56..177e41061a4 100644
--- a/tests/Core/Controller/LostControllerTest.php
+++ b/tests/Core/Controller/LostControllerTest.php
@@ -24,6 +24,7 @@ namespace Tests\Core\Controller;
use OC\Core\Controller\LostController;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\Encryption\IManager;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IRequest;
@@ -59,6 +60,8 @@ class LostControllerTest extends \PHPUnit_Framework_TestCase {
private $mailer;
/** @var ISecureRandom | PHPUnit_Framework_MockObject_MockObject */
private $secureRandom;
+ /** @var IManager|PHPUnit_Framework_MockObject_MockObject */
+ private $encryptionManager;
/** @var ITimeFactory | PHPUnit_Framework_MockObject_MockObject */
private $timeFactory;
/** @var IRequest */
@@ -98,6 +101,11 @@ class LostControllerTest extends \PHPUnit_Framework_TestCase {
->disableOriginalConstructor()->getMock();
$this->request = $this->getMockBuilder('OCP\IRequest')
->disableOriginalConstructor()->getMock();
+ $this->encryptionManager = $this->getMockBuilder(IManager::class)
+ ->disableOriginalConstructor()->getMock();
+ $this->encryptionManager->expects($this->any())
+ ->method('isEnabled')
+ ->willReturn(true);
$this->lostController = new LostController(
'Core',
$this->request,
@@ -108,7 +116,7 @@ class LostControllerTest extends \PHPUnit_Framework_TestCase {
$this->config,
$this->secureRandom,
'lostpassword-noreply@localhost',
- true,
+ $this->encryptionManager,
$this->mailer,
$this->timeFactory
);
@@ -162,8 +170,6 @@ class LostControllerTest extends \PHPUnit_Framework_TestCase {
public function testResetFormExpiredToken() {
- $userId = 'ValidTokenUser';
- $token = '12345:TheOnlyAndOnlyOneTokenToResetThePassword';
$user = $this->getMockBuilder('\OCP\IUser')
->disableOriginalConstructor()->getMock();
$this->userManager
@@ -195,8 +201,6 @@ class LostControllerTest extends \PHPUnit_Framework_TestCase {
}
public function testResetFormValidToken() {
- $userId = 'ValidTokenUser';
- $token = '12345:TheOnlyAndOnlyOneTokenToResetThePassword';
$user = $this->getMockBuilder('\OCP\IUser')
->disableOriginalConstructor()->getMock();
$user