2017-05-18 20:09:59 +03:00
|
|
|
<?php
|
2019-09-26 21:12:24 +03:00
|
|
|
|
2017-05-18 20:09:59 +03:00
|
|
|
/**
|
|
|
|
* @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
|
|
|
|
*
|
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace OCA\OAuth2\Tests\Settings;
|
|
|
|
|
2019-09-26 21:12:24 +03:00
|
|
|
use OCA\OAuth2\Db\ClientMapper;
|
2017-05-18 20:09:59 +03:00
|
|
|
use OCA\OAuth2\Settings\Admin;
|
|
|
|
use OCP\AppFramework\Http\TemplateResponse;
|
2019-09-26 21:12:24 +03:00
|
|
|
use OCP\IInitialStateService;
|
2017-05-18 20:09:59 +03:00
|
|
|
use Test\TestCase;
|
2019-09-26 21:12:24 +03:00
|
|
|
use PHPUnit\Framework\MockObject\MockObject;
|
2017-05-18 20:09:59 +03:00
|
|
|
|
|
|
|
class AdminTest extends TestCase {
|
2019-09-26 21:12:24 +03:00
|
|
|
|
|
|
|
/** @var Admin|MockObject */
|
2017-05-18 20:09:59 +03:00
|
|
|
private $admin;
|
|
|
|
|
2019-09-26 21:12:24 +03:00
|
|
|
/** @var IInitialStateService|MockObject */
|
|
|
|
private $initialStateService;
|
|
|
|
|
|
|
|
/** @var ClientMapper|MockObject */
|
|
|
|
private $clientMapper;
|
|
|
|
|
2017-05-18 20:09:59 +03:00
|
|
|
public function setUp() {
|
|
|
|
parent::setUp();
|
|
|
|
|
2019-09-26 21:12:24 +03:00
|
|
|
$this->initialStateService = $this->createMock(IInitialStateService::class);
|
|
|
|
$this->clientMapper = $this->createMock(ClientMapper::class);
|
|
|
|
|
|
|
|
$this->admin = new Admin($this->initialStateService, $this->clientMapper);
|
2017-05-18 20:09:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetForm() {
|
|
|
|
$expected = new TemplateResponse(
|
|
|
|
'oauth2',
|
|
|
|
'admin',
|
2019-09-26 21:12:24 +03:00
|
|
|
[],
|
2017-05-18 20:09:59 +03:00
|
|
|
''
|
|
|
|
);
|
|
|
|
$this->assertEquals($expected, $this->admin->getForm());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetSection() {
|
|
|
|
$this->assertSame('security', $this->admin->getSection());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetPriority() {
|
2019-07-01 10:52:27 +03:00
|
|
|
$this->assertSame(100, $this->admin->getPriority());
|
2017-05-18 20:09:59 +03:00
|
|
|
}
|
|
|
|
}
|