From 27259ea2a21cf0227be12bc9bfc2c997bc6ee44f Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 13 Jun 2018 21:29:45 +0200 Subject: [PATCH] Fix AdminTests Signed-off-by: Roeland Jago Douma --- apps/oauth2/lib/Settings/Admin.php | 26 ++++-------------------- apps/oauth2/tests/Settings/AdminTest.php | 12 +---------- 2 files changed, 5 insertions(+), 33 deletions(-) diff --git a/apps/oauth2/lib/Settings/Admin.php b/apps/oauth2/lib/Settings/Admin.php index 7460f86ca5..0553f35f1c 100644 --- a/apps/oauth2/lib/Settings/Admin.php +++ b/apps/oauth2/lib/Settings/Admin.php @@ -1,4 +1,5 @@ * @@ -21,25 +22,12 @@ namespace OCA\OAuth2\Settings; -use OCA\OAuth2\Db\ClientMapper; use OCP\AppFramework\Http\TemplateResponse; use OCP\Settings\ISettings; class Admin implements ISettings { - /** @var ClientMapper */ - private $clientMapper; - /** - * @param ClientMapper $clientMapper - */ - public function __construct(ClientMapper $clientMapper) { - $this->clientMapper = $clientMapper; - } - - /** - * @return TemplateResponse - */ - public function getForm() { + public function getForm(): TemplateResponse { return new TemplateResponse( 'oauth2', 'admin', @@ -48,17 +36,11 @@ class Admin implements ISettings { ); } - /** - * {@inheritdoc} - */ - public function getSection() { + public function getSection(): string { return 'security'; } - /** - * {@inheritdoc} - */ - public function getPriority() { + public function getPriority(): int { return 0; } } diff --git a/apps/oauth2/tests/Settings/AdminTest.php b/apps/oauth2/tests/Settings/AdminTest.php index 9c3d5ed144..8b0883c756 100644 --- a/apps/oauth2/tests/Settings/AdminTest.php +++ b/apps/oauth2/tests/Settings/AdminTest.php @@ -21,35 +21,25 @@ namespace OCA\OAuth2\Tests\Settings; -use OCA\OAuth2\Db\ClientMapper; use OCA\OAuth2\Settings\Admin; use OCP\AppFramework\Http\TemplateResponse; use Test\TestCase; class AdminTest extends TestCase { - /** @var ClientMapper|\PHPUnit_Framework_MockObject_MockObject */ - private $clientMapper; /** @var Admin|\PHPUnit_Framework_MockObject_MockObject */ private $admin; public function setUp() { parent::setUp(); - $this->clientMapper = $this->createMock(ClientMapper::class); - $this->admin = new Admin($this->clientMapper); + $this->admin = new Admin(); } public function testGetForm() { - $this->clientMapper - ->expects($this->once()) - ->method('getClients') - ->willReturn(['MyClients']); - $expected = new TemplateResponse( 'oauth2', 'admin', [ - 'clients' => ['MyClients'], ], '' );