diff options
Diffstat (limited to 'tests/Core/Controller/TokenControllerTest.php')
-rw-r--r-- | tests/Core/Controller/TokenControllerTest.php | 16 |
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') |