1
0

AdminTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\OAuth2\Tests\Settings;
  7. use OCA\OAuth2\Db\ClientMapper;
  8. use OCA\OAuth2\Settings\Admin;
  9. use OCP\AppFramework\Http\TemplateResponse;
  10. use OCP\AppFramework\Services\IInitialState;
  11. use OCP\IURLGenerator;
  12. use OCP\Security\ICrypto;
  13. use PHPUnit\Framework\MockObject\MockObject;
  14. use Psr\Log\LoggerInterface;
  15. use Test\TestCase;
  16. class AdminTest extends TestCase {
  17. /** @var Admin|MockObject */
  18. private $admin;
  19. /** @var IInitialStateService|MockObject */
  20. private $initialState;
  21. /** @var ClientMapper|MockObject */
  22. private $clientMapper;
  23. protected function setUp(): void {
  24. parent::setUp();
  25. $this->initialState = $this->createMock(IInitialState::class);
  26. $this->clientMapper = $this->createMock(ClientMapper::class);
  27. $this->admin = new Admin(
  28. $this->initialState,
  29. $this->clientMapper,
  30. $this->createMock(IURLGenerator::class),
  31. $this->createMock(ICrypto::class),
  32. $this->createMock(LoggerInterface::class)
  33. );
  34. }
  35. public function testGetForm() {
  36. $expected = new TemplateResponse(
  37. 'oauth2',
  38. 'admin',
  39. [],
  40. ''
  41. );
  42. $this->assertEquals($expected, $this->admin->getForm());
  43. }
  44. public function testGetSection() {
  45. $this->assertSame('security', $this->admin->getSection());
  46. }
  47. public function testGetPriority() {
  48. $this->assertSame(100, $this->admin->getPriority());
  49. }
  50. }