Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-08-29 22:17:16 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2016-08-29 22:52:09 +0300
commitf6423f74e3ca925fd43c67f2669384994ccc55fe (patch)
tree1ea6c8b142e584cc2b11fd56e206f86c059ad138 /tests
parentc0ed865ab2e5166e71fd6046fc2c426dd5b7c6d4 (diff)
Minor cleanup in core Controllers
Diffstat (limited to 'tests')
-rw-r--r--tests/Core/Controller/TokenControllerTest.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/Core/Controller/TokenControllerTest.php b/tests/Core/Controller/TokenControllerTest.php
index b6b54b14fad..0e965aac2e5 100644
--- a/tests/Core/Controller/TokenControllerTest.php
+++ b/tests/Core/Controller/TokenControllerTest.php
@@ -41,15 +41,17 @@ class TokenControllerTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->request = $this->getMock('\OCP\IRequest');
+ $this->request = $this->getMockBuilder('\OCP\IRequest')->getMock();
$this->userManager = $this->getMockBuilder('\OC\User\Manager')
->disableOriginalConstructor()
->getMock();
- $this->tokenProvider = $this->getMock('\OC\Authentication\Token\IProvider');
+ $this->tokenProvider = $this->getMockBuilder('\OC\Authentication\Token\IProvider')
+ ->getMock();
$this->twoFactorAuthManager = $this->getMockBuilder('\OC\Authentication\TwoFactorAuth\Manager')
->disableOriginalConstructor()
->getMock();
- $this->secureRandom = $this->getMock('\OCP\Security\ISecureRandom');
+ $this->secureRandom = $this->getMockBuilder('\OCP\Security\ISecureRandom')
+ ->getMock();
$this->tokenController = new TokenController('core', $this->request, $this->userManager, $this->tokenProvider, $this->twoFactorAuthManager, $this->secureRandom);
}
@@ -77,7 +79,7 @@ class TokenControllerTest extends TestCase {
}
public function testWithValidCredentials() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')->getMock();
$this->userManager->expects($this->once())
->method('checkPassword')
->with('john', '123456')
@@ -96,9 +98,9 @@ class TokenControllerTest extends TestCase {
$this->tokenProvider->expects($this->once())
->method('generateToken')
->with('verysecurerandomtoken', 'john', 'john', '123456', 'unknown client', IToken::PERMANENT_TOKEN);
- $expected = [
+ $expected = new JSONResponse([
'token' => 'verysecurerandomtoken'
- ];
+ ]);
$actual = $this->tokenController->generateToken('john', '123456');
@@ -106,7 +108,7 @@ class TokenControllerTest extends TestCase {
}
public function testWithValidCredentialsBut2faEnabled() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')->getMock();
$this->userManager->expects($this->once())
->method('checkPassword')
->with('john', '123456')