diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-31 10:40:55 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-31 10:40:55 +0300 |
commit | 660e2b36cb788b7a5de87a4975078ea39fb58246 (patch) | |
tree | 98e29fc9699807f96d3558e9315eddf19beef81d /tests/Unit | |
parent | eee0bf925cc536d5ae2e5ede5618306b6f3bc0da (diff) |
Clean up php coding style
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/Unit')
-rw-r--r-- | tests/Unit/Activity/ProviderTest.php | 12 | ||||
-rw-r--r-- | tests/Unit/Activity/SettingTest.php | 2 | ||||
-rw-r--r-- | tests/Unit/Controller/SettingsControllerTest.php | 17 | ||||
-rw-r--r-- | tests/Unit/Provider/AtLoginProviderTest.php | 2 |
4 files changed, 15 insertions, 18 deletions
diff --git a/tests/Unit/Activity/ProviderTest.php b/tests/Unit/Activity/ProviderTest.php index d798fcf..05e47c6 100644 --- a/tests/Unit/Activity/ProviderTest.php +++ b/tests/Unit/Activity/ProviderTest.php @@ -55,7 +55,7 @@ class ProviderTest extends TestCase { $event = $this->createMock(IEvent::class); $event->expects($this->once()) ->method('getApp') - ->will($this->returnValue('comments')); + ->willReturn('comments'); $this->expectException(InvalidArgumentException::class); $this->provider->parse($lang, $event); @@ -79,25 +79,25 @@ class ProviderTest extends TestCase { $event->expects($this->once()) ->method('getApp') - ->will($this->returnValue('twofactor_totp')); + ->willReturn('twofactor_totp'); $this->l10n->expects($this->once()) ->method('get') ->with('twofactor_totp', $lang) - ->will($this->returnValue($l)); + ->willReturn($l); $this->urlGenerator->expects($this->once()) ->method('imagePath') ->with('core', 'actions/password.svg') - ->will($this->returnValue('path/to/image')); + ->willReturn('path/to/image'); $this->urlGenerator->expects($this->once()) ->method('getAbsoluteURL') ->with('path/to/image') - ->will($this->returnValue('absolute/path/to/image')); + ->willReturn('absolute/path/to/image'); $event->expects($this->once()) ->method('setIcon') ->with('absolute/path/to/image'); $event->expects($this->once()) ->method('getSubject') - ->will($this->returnValue($subject)); + ->willReturn($subject); $event->expects($this->once()) ->method('setSubject'); diff --git a/tests/Unit/Activity/SettingTest.php b/tests/Unit/Activity/SettingTest.php index 642a924..76debf0 100644 --- a/tests/Unit/Activity/SettingTest.php +++ b/tests/Unit/Activity/SettingTest.php @@ -48,7 +48,7 @@ class SettingTest extends TestCase { $this->l10n->expects($this->once()) ->method('t') ->with('TOTP (Authenticator app)') - ->will($this->returnValue('TOTP (Google Authentifizierer)')); + ->willReturn('TOTP (Google Authentifizierer)'); $this->assertEquals('TOTP (Google Authentifizierer)', $this->setting->getName()); $this->assertEquals(10, $this->setting->getPriority()); $this->assertEquals(true, $this->setting->isDefaultEnabledMail()); diff --git a/tests/Unit/Controller/SettingsControllerTest.php b/tests/Unit/Controller/SettingsControllerTest.php index db0af7f..88eef84 100644 --- a/tests/Unit/Controller/SettingsControllerTest.php +++ b/tests/Unit/Controller/SettingsControllerTest.php @@ -22,7 +22,6 @@ namespace OCA\TwoFactorTOTP\Unit\Controller; -use Endroid\QrCode\QrCode; use InvalidArgumentException; use OCA\TwoFactorTOTP\Controller\SettingsController; use OCA\TwoFactorTOTP\Service\ITotp; @@ -59,11 +58,11 @@ class SettingsControllerTest extends TestCase { $user = $this->createMock(IUser::class); $this->userSession->expects($this->once()) ->method('getUser') - ->will($this->returnValue($user)); + ->willReturn($user); $this->totp->expects($this->once()) ->method('hasSecret') ->with($user) - ->will($this->returnValue(false)); + ->willReturn(false); $expected = new JSONResponse([ 'state' => false, @@ -76,14 +75,14 @@ class SettingsControllerTest extends TestCase { $user = $this->createMock(IUser::class); $this->userSession->expects($this->exactly(2)) ->method('getUser') - ->will($this->returnValue($user)); + ->willReturn($user); $user->expects($this->once()) ->method('getCloudId') - ->will($this->returnValue('user@instance.com')); + ->willReturn('user@instance.com'); $this->totp->expects($this->once()) ->method('createSecret') ->with($user) - ->will($this->returnValue('newsecret')); + ->willReturn('newsecret'); $issuer = rawurlencode($this->defaults->getName()); $expected = new JSONResponse([ 'state' => ITotp::STATE_CREATED, @@ -98,7 +97,7 @@ class SettingsControllerTest extends TestCase { $user = $this->createMock(IUser::class); $this->userSession->expects($this->once()) ->method('getUser') - ->will($this->returnValue($user)); + ->willReturn($user); $this->totp->expects($this->once()) ->method('enable') ->with($user, '123456') @@ -115,7 +114,7 @@ class SettingsControllerTest extends TestCase { $user = $this->createMock(IUser::class); $this->userSession->expects($this->once()) ->method('getUser') - ->will($this->returnValue($user)); + ->willReturn($user); $this->totp->expects($this->once()) ->method('deleteSecret'); @@ -130,7 +129,7 @@ class SettingsControllerTest extends TestCase { $user = $this->createMock(IUser::class); $this->userSession->expects($this->once()) ->method('getUser') - ->will($this->returnValue($user)); + ->willReturn($user); $this->expectException(InvalidArgumentException::class); $this->controller->enable(17); diff --git a/tests/Unit/Provider/AtLoginProviderTest.php b/tests/Unit/Provider/AtLoginProviderTest.php index 7f2b341..ac610f8 100644 --- a/tests/Unit/Provider/AtLoginProviderTest.php +++ b/tests/Unit/Provider/AtLoginProviderTest.php @@ -23,10 +23,8 @@ namespace OCA\TwoFactorTOTP\Test\Unit\Provider; use ChristophWurst\Nextcloud\Testing\TestCase; -use OCA\TwoFactorTOTP\AppInfo\Application; use OCA\TwoFactorTOTP\Provider\AtLoginProvider; use OCP\IURLGenerator; -use OCP\Template; use PHPUnit\Framework\MockObject\MockObject; class AtLoginProviderTest extends TestCase { |