diff options
author | Joas Schilling <coding@schilljs.com> | 2020-07-10 11:13:03 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-07-10 11:13:03 +0300 |
commit | f224b89da3928d63ad73eed6b292a0d6b998730a (patch) | |
tree | 5d840f6c3cefd1438c308d77abde76f73ec2c454 /tests | |
parent | 3b42325d5da4aa03dd6af851c4c4f0e78944adc4 (diff) |
CS auto fixes
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Integration/Controller/RegisterControllerTest.php | 12 | ||||
-rw-r--r-- | tests/Integration/Service/RegistrationServiceTest.php | 8 | ||||
-rw-r--r-- | tests/Unit/Controller/ApiControllerTest.php | 22 |
3 files changed, 18 insertions, 24 deletions
diff --git a/tests/Integration/Controller/RegisterControllerTest.php b/tests/Integration/Controller/RegisterControllerTest.php index 3f68394..6b310e6 100644 --- a/tests/Integration/Controller/RegisterControllerTest.php +++ b/tests/Integration/Controller/RegisterControllerTest.php @@ -2,13 +2,9 @@ namespace OCA\Registration\Tests\Integration\Controller; -use OCA\Registration\Db\Registration; use OCA\Registration\Db\RegistrationMapper; use OCA\Registration\Service\MailService; use OCA\Registration\Service\RegistrationService; -use OCA\Registration\Util\CoreBridge; -use OCP\AppFramework\Http; -use OCP\AppFramework\Http\DataResponse; use OCP\Defaults; use OCP\IConfig; use OCP\IGroupManager; @@ -19,7 +15,6 @@ use OCP\IRequest; use OCP\Security\ISecureRandom; use OCP\Security\ICrypto; use OCP\ISession; -use OCP\IUser; use OCP\IURLGenerator; use OCP\IUserManager; use OCP\IUserSession; @@ -28,6 +23,7 @@ use \OCP\AppFramework\Http\TemplateResponse; use ChristophWurst\Nextcloud\Testing\DatabaseTransaction; use ChristophWurst\Nextcloud\Testing\TestCase; + /** * class RegistrationControllerTest * @@ -67,7 +63,7 @@ class RegisterControllerTest extends TestCase { /** @var ICrypto */ private $crypto; - public function setUp (): void { + public function setUp(): void { parent::setUp(); $this->mailService = $this->createMock(MailService::class); $this->l10n = $this->createMock(IL10N::class); @@ -134,9 +130,9 @@ class RegisterControllerTest extends TestCase { $ret = $this->controller->validateEmail($email); - $expected = new TemplateResponse('registration', 'message', array('msg' => + $expected = new TemplateResponse('registration', 'message', ['msg' => $this->l10n->t('Verification email successfully sent.') - ), 'guest'); + ], 'guest'); $this->assertEquals($expected, $ret, print_r($ret, true)); diff --git a/tests/Integration/Service/RegistrationServiceTest.php b/tests/Integration/Service/RegistrationServiceTest.php index d192dc4..72392ca 100644 --- a/tests/Integration/Service/RegistrationServiceTest.php +++ b/tests/Integration/Service/RegistrationServiceTest.php @@ -6,9 +6,6 @@ use OCA\Registration\Db\Registration; use OCA\Registration\Db\RegistrationMapper; use OCA\Registration\Service\MailService; use OCA\Registration\Service\RegistrationService; -use OCA\Registration\Util\CoreBridge; -use OCP\AppFramework\Http; -use OCP\AppFramework\Http\DataResponse; use OCP\Defaults; use OCP\IConfig; use OCP\IGroupManager; @@ -26,6 +23,7 @@ use OCP\IUserSession; use ChristophWurst\Nextcloud\Testing\DatabaseTransaction; use ChristophWurst\Nextcloud\Testing\TestCase; + /** * class RegistrationServiceTest * @@ -65,7 +63,7 @@ class RegistrationServiceTest extends TestCase { /** @var ICrypto */ private $crypto; - public function setUp (): void { + public function setUp(): void { parent::setUp(); $this->mailService = $this->createMock(MailService::class); $this->l10n = $this->createMock(IL10N::class); @@ -202,7 +200,7 @@ class RegistrationServiceTest extends TestCase { $this->config->expects($this->atLeastOnce()) ->method('getAppValue') - ->will($this->returnCallback(array($this, 'settingsCallback1'))); + ->will($this->returnCallback([$this, 'settingsCallback1'])); $form_input_username = 'alice1'; diff --git a/tests/Unit/Controller/ApiControllerTest.php b/tests/Unit/Controller/ApiControllerTest.php index 1229ddc..2f0221f 100644 --- a/tests/Unit/Controller/ApiControllerTest.php +++ b/tests/Unit/Controller/ApiControllerTest.php @@ -38,7 +38,7 @@ class ApiControllerTest extends TestCase { /** @var ApiController */ private $controller; - public function setUp (): void { + public function setUp(): void { parent::setUp(); $this->request = $this->createMock(IRequest::class); $this->registrationService = $this->createMock(RegistrationService::class); @@ -79,9 +79,9 @@ class ApiControllerTest extends TestCase { } public function testValidateFailEmail() { - $exception = CoreBridge::createException('OCSException', '', 999); + $exception = CoreBridge::createException('OCSException', '', 999); - $this->expectException(get_class($exception)); + $this->expectException(get_class($exception)); $this->registrationService ->expects($this->once()) @@ -92,11 +92,11 @@ class ApiControllerTest extends TestCase { } public function testValidateFailDisplayname() { - $exception = CoreBridge::createException('OCSException', '', 999); + $exception = CoreBridge::createException('OCSException', '', 999); - $this->expectException(get_class($exception)); + $this->expectException(get_class($exception)); - $this->registrationService + $this->registrationService ->expects($this->once()) ->method('validateDisplayname') ->willThrowException($exception); @@ -105,11 +105,11 @@ class ApiControllerTest extends TestCase { } public function testValidateFailUsername() { - $exception = CoreBridge::createException('OCSException', '', 999); + $exception = CoreBridge::createException('OCSException', '', 999); - $this->expectException(get_class($exception)); + $this->expectException(get_class($exception)); - $this->registrationService + $this->registrationService ->expects($this->once()) ->method('validateUsername') ->willThrowException($exception); @@ -118,9 +118,9 @@ class ApiControllerTest extends TestCase { } public function testStatusNoRegistration() { - $exception = CoreBridge::createException('OCSNotFoundException', '', 404); + $exception = CoreBridge::createException('OCSNotFoundException', '', 404); - $this->expectException(get_class($exception)); + $this->expectException(get_class($exception)); $this->registrationService ->method('getRegistrationForSecret') |