AdminTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 PHPUnit\Framework\MockObject\MockObject;
  13. use Psr\Log\LoggerInterface;
  14. use Test\TestCase;
  15. class AdminTest extends TestCase {
  16. /** @var Admin|MockObject */
  17. private $admin;
  18. /** @var IInitialState|MockObject */
  19. private $initialState;
  20. /** @var ClientMapper|MockObject */
  21. private $clientMapper;
  22. protected function setUp(): void {
  23. parent::setUp();
  24. $this->initialState = $this->createMock(IInitialState::class);
  25. $this->clientMapper = $this->createMock(ClientMapper::class);
  26. $this->admin = new Admin(
  27. $this->initialState,
  28. $this->clientMapper,
  29. $this->createMock(IURLGenerator::class),
  30. $this->createMock(LoggerInterface::class)
  31. );
  32. }
  33. public function testGetForm(): void {
  34. $expected = new TemplateResponse(
  35. 'oauth2',
  36. 'admin',
  37. [],
  38. ''
  39. );
  40. $this->assertEquals($expected, $this->admin->getForm());
  41. }
  42. public function testGetSection(): void {
  43. $this->assertSame('security', $this->admin->getSection());
  44. }
  45. public function testGetPriority(): void {
  46. $this->assertSame(100, $this->admin->getPriority());
  47. }
  48. }