Use createMock instead of deprecated getMock

This commit is contained in:
Lukas Reschke 2016-08-11 15:14:24 +02:00 committed by Jan-Christoph Borchardt
parent be1e64486f
commit 9ac6b83687
1 changed files with 12 additions and 12 deletions

View 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'));