From 72b5f9bfac34e3c5334ff22dfacd097787457f55 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Thu, 11 Aug 2016 15:14:24 +0200 Subject: [PATCH] Use createMock instead of deprecated getMock --- tests/Core/Controller/LoginControllerTest.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php index 57fd5214021..a322289d200 100644 --- a/tests/Core/Controller/LoginControllerTest.php +++ b/tests/Core/Controller/LoginControllerTest.php @@ -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')); -- 2.39.5