diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 17:27:18 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 17:27:18 +0300 |
commit | 3a7cf40aaa678bea1df143d2982d603b7a334eec (patch) | |
tree | 63c1e3ad7f7f401d14411a4d44c523632906afc9 /apps/oauth2 | |
parent | 0568b012672d650c6b5a49e72c4028dde5463c60 (diff) |
Mode to modern phpunit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/oauth2')
6 files changed, 15 insertions, 15 deletions
diff --git a/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php b/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php index 3b18290ff8d..fb116ec2265 100644 --- a/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php +++ b/apps/oauth2/tests/Controller/LoginRedirectorControllerTest.php @@ -48,7 +48,7 @@ class LoginRedirectorControllerTest extends TestCase { /** @var IL10N */ private $l; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->request = $this->createMock(IRequest::class); diff --git a/apps/oauth2/tests/Controller/OauthApiControllerTest.php b/apps/oauth2/tests/Controller/OauthApiControllerTest.php index 1c7bed848a7..613f97c9ced 100644 --- a/apps/oauth2/tests/Controller/OauthApiControllerTest.php +++ b/apps/oauth2/tests/Controller/OauthApiControllerTest.php @@ -61,7 +61,7 @@ class OauthApiControllerTest extends TestCase { /** @var OauthApiController */ private $oauthApiController; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->request = $this->createMock(IRequest::class); diff --git a/apps/oauth2/tests/Controller/SettingsControllerTest.php b/apps/oauth2/tests/Controller/SettingsControllerTest.php index 6519f9cf087..2be63267a75 100644 --- a/apps/oauth2/tests/Controller/SettingsControllerTest.php +++ b/apps/oauth2/tests/Controller/SettingsControllerTest.php @@ -47,7 +47,7 @@ class SettingsControllerTest extends TestCase { /** @var SettingsController */ private $settingsController; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->request = $this->createMock(IRequest::class); diff --git a/apps/oauth2/tests/Db/AccessTokenMapperTest.php b/apps/oauth2/tests/Db/AccessTokenMapperTest.php index 8d60b10d145..dc5ecb27efb 100644 --- a/apps/oauth2/tests/Db/AccessTokenMapperTest.php +++ b/apps/oauth2/tests/Db/AccessTokenMapperTest.php @@ -32,7 +32,7 @@ class AccessTokenMapperTest extends TestCase { /** @var AccessTokenMapper */ private $accessTokenMapper; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->accessTokenMapper = new AccessTokenMapper(\OC::$server->getDatabaseConnection()); } @@ -52,10 +52,10 @@ class AccessTokenMapperTest extends TestCase { $this->accessTokenMapper->delete($token); } - /** - * @expectedException \OCA\OAuth2\Exceptions\AccessTokenNotFoundException - */ + public function testDeleteByClientId() { + $this->expectException(\OCA\OAuth2\Exceptions\AccessTokenNotFoundException::class); + $this->accessTokenMapper->deleteByClientId(1234); $token = new AccessToken(); $token->setClientId(1234); diff --git a/apps/oauth2/tests/Db/ClientMapperTest.php b/apps/oauth2/tests/Db/ClientMapperTest.php index 78400672cbb..1448cff109e 100644 --- a/apps/oauth2/tests/Db/ClientMapperTest.php +++ b/apps/oauth2/tests/Db/ClientMapperTest.php @@ -32,7 +32,7 @@ class ClientMapperTest extends TestCase { /** @var ClientMapper */ private $clientMapper; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->clientMapper = new ClientMapper(\OC::$server->getDatabaseConnection()); } @@ -48,10 +48,10 @@ class ClientMapperTest extends TestCase { $this->assertEquals($client, $this->clientMapper->getByIdentifier('MyAwesomeClientIdentifier')); } - /** - * @expectedException \OCA\OAuth2\Exceptions\ClientNotFoundException - */ + public function testGetByIdentifierNotExisting() { + $this->expectException(\OCA\OAuth2\Exceptions\ClientNotFoundException::class); + $this->clientMapper->getByIdentifier('MyTotallyNotExistingClient'); } @@ -66,10 +66,10 @@ class ClientMapperTest extends TestCase { $this->assertEquals($client, $this->clientMapper->getByUid($client->getId())); } - /** - * @expectedException \OCA\OAuth2\Exceptions\ClientNotFoundException - */ + public function testGetByUidNotExisting() { + $this->expectException(\OCA\OAuth2\Exceptions\ClientNotFoundException::class); + $this->clientMapper->getByUid(1234); } diff --git a/apps/oauth2/tests/Settings/AdminTest.php b/apps/oauth2/tests/Settings/AdminTest.php index ec8787db83f..2e5b0dcadba 100644 --- a/apps/oauth2/tests/Settings/AdminTest.php +++ b/apps/oauth2/tests/Settings/AdminTest.php @@ -40,7 +40,7 @@ class AdminTest extends TestCase { /** @var ClientMapper|MockObject */ private $clientMapper; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->initialStateService = $this->createMock(IInitialStateService::class); |