]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use createMock instead of deprecated getMock 837/head
authorLukas Reschke <lukas@statuscode.ch>
Thu, 11 Aug 2016 13:14:24 +0000 (15:14 +0200)
committerLukas Reschke <lukas@statuscode.ch>
Thu, 11 Aug 2016 13:22:29 +0000 (15:22 +0200)
tests/Core/Controller/LoginControllerTest.php

index 57fd5214021a8cbe621deafb4286dad69025602e..a322289d20013434280f3da0e5180769bc9aba66 100644 (file)
@@ -57,14 +57,14 @@ class LoginControllerTest extends TestCase {
 
        public function setUp() {
                parent::setUp();
-               $this->request = $this->getMock('\\OCP\\IRequest');
-               $this->userManager = $this->getMock('\\OCP\\IUserManager');
-               $this->config = $this->getMock('\\OCP\\IConfig');
-               $this->session = $this->getMock('\\OCP\\ISession');
+               $this->request = $this->createMock('\\OCP\\IRequest');
+               $this->userManager = $this->createMock('\\OCP\\IUserManager');
+               $this->config = $this->createMock('\\OCP\\IConfig');
+               $this->session = $this->createMock('\\OCP\\ISession');
                $this->userSession = $this->getMockBuilder('\\OC\\User\\Session')
                        ->disableOriginalConstructor()
                        ->getMock();
-               $this->urlGenerator = $this->getMock('\\OCP\\IURLGenerator');
+               $this->urlGenerator = $this->createMock('\\OCP\\IURLGenerator');
                $this->twoFactorManager = $this->getMockBuilder('\OC\Authentication\TwoFactorAuth\Manager')
                        ->disableOriginalConstructor()
                        ->getMock();
@@ -110,7 +110,7 @@ class LoginControllerTest extends TestCase {
                        ->method('getCookie')
                        ->with('oc_token')
                        ->willReturn('MyLoginToken');
-               $user = $this->getMock('\\OCP\\IUser');
+               $user = $this->createMock('\\OCP\\IUser');
                $user
                        ->expects($this->once())
                        ->method('getUID')
@@ -217,7 +217,7 @@ class LoginControllerTest extends TestCase {
                        ->method('getSystemValue')
                        ->with('lost_password_link')
                        ->willReturn(false);
-               $user = $this->getMock('\\OCP\\IUser');
+               $user = $this->createMock('\\OCP\\IUser');
                $user
                        ->expects($this->once())
                        ->method('canChangePassword')
@@ -255,7 +255,7 @@ class LoginControllerTest extends TestCase {
                        ->method('getSystemValue')
                        ->with('lost_password_link')
                        ->willReturn(false);
-               $user = $this->getMock('\\OCP\\IUser');
+               $user = $this->createMock('\\OCP\\IUser');
                $user
                        ->expects($this->once())
                        ->method('canChangePassword')
@@ -326,7 +326,7 @@ class LoginControllerTest extends TestCase {
 
        public function testLoginWithValidCredentials() {
                /** @var IUser | \PHPUnit_Framework_MockObject_MockObject $user */
-               $user = $this->getMock('\OCP\IUser');
+               $user = $this->createMock('\OCP\IUser');
                $password = 'secret';
                $indexPageUrl = 'some url';
 
@@ -446,7 +446,7 @@ class LoginControllerTest extends TestCase {
 
        public function testLoginWithValidCredentialsAndRedirectUrl() {
                /** @var IUser | \PHPUnit_Framework_MockObject_MockObject $user */
-               $user = $this->getMock('\OCP\IUser');
+               $user = $this->createMock('\OCP\IUser');
                $user->expects($this->any())
                        ->method('getUID')
                        ->will($this->returnValue('jane'));
@@ -493,7 +493,7 @@ class LoginControllerTest extends TestCase {
        
        public function testLoginWithTwoFactorEnforced() {
                /** @var IUser | \PHPUnit_Framework_MockObject_MockObject $user */
-               $user = $this->getMock('\OCP\IUser');
+               $user = $this->createMock('\OCP\IUser');
                $user->expects($this->any())
                        ->method('getUID')
                        ->will($this->returnValue('john'));
@@ -544,7 +544,7 @@ class LoginControllerTest extends TestCase {
 
        public function testToNotLeakLoginName() {
                /** @var IUser | \PHPUnit_Framework_MockObject_MockObject $user */
-               $user = $this->getMock('\OCP\IUser');
+               $user = $this->createMock('\OCP\IUser');
                $user->expects($this->any())
                        ->method('getUID')
                        ->will($this->returnValue('john'));