2017-05-18 20:09:59 +03:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
|
|
|
|
*
|
2019-12-03 21:57:53 +03:00
|
|
|
* @author Lukas Reschke <lukas@statuscode.ch>
|
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
|
|
|
*
|
2017-05-18 20:09:59 +03:00
|
|
|
* @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
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2017-05-18 20:09:59 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
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;
|
|
|
|
use PHPUnit\Framework\MockObject\MockObject;
|
2019-11-22 22:52:10 +03:00
|
|
|
use Test\TestCase;
|
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;
|
|
|
|
|
2019-11-27 17:27:18 +03:00
|
|
|
protected function setUp(): void {
|
2017-05-18 20:09:59 +03:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|