aboutsummaryrefslogtreecommitdiffstats
path: root/apps/oauth2/tests/Settings/AdminTest.php
blob: 9cbefb74671773821545a59325d4d3a87281afa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
 * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
namespace OCA\OAuth2\Tests\Settings;

use OCA\OAuth2\Db\ClientMapper;
use OCA\OAuth2\Settings\Admin;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\IURLGenerator;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;

class AdminTest extends TestCase {

	/** @var Admin|MockObject */
	private $admin;

	/** @var IInitialState|MockObject */
	private $initialState;

	/** @var ClientMapper|MockObject */
	private $clientMapper;

	protected function setUp(): void {
		parent::setUp();

		$this->initialState = $this->createMock(IInitialState::class);
		$this->clientMapper = $this->createMock(ClientMapper::class);

		$this->admin = new Admin(
			$this->initialState,
			$this->clientMapper,
			$this->createMock(IURLGenerator::class),
			$this->createMock(LoggerInterface::class)
		);
	}

	public function testGetForm() {
		$expected = new TemplateResponse(
			'oauth2',
			'admin',
			[],
			''
		);
		$this->assertEquals($expected, $this->admin->getForm());
	}

	public function testGetSection() {
		$this->assertSame('security', $this->admin->getSection());
	}

	public function testGetPriority() {
		$this->assertSame(100, $this->admin->getPriority());
	}
}