nextcloud/apps/oauth2/tests/Controller/SettingsControllerTest.php
Carl Schwan 734904e7f0
feat(oauth2): Add commands for adding and deleting clients
Refactor the code for doing that from the controller to a seperate
service.

Signed-off-by: Carl Schwan <carlschwan@kde.org>
2026-06-15 13:06:09 +02:00

27 lines
818 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\OAuth2\Tests\Controller;
use OCA\OAuth2\Controller\SettingsController;
use OCP\AppFramework\Http;
use OCP\Server;
use PHPUnit\Framework\Attributes\Group;
use Test\TestCase;
#[Group(name: 'DB')]
class SettingsControllerTest extends TestCase {
public function testInvalidRedirectUri(): void {
$settingsController = Server::get(SettingsController::class);
$result = $settingsController->addClient('test', 'invalidurl');
$this->assertEquals(Http::STATUS_BAD_REQUEST, $result->getStatus());
$this->assertSame(['message' => 'Your redirect URL needs to be a full URL for example: https://yourdomain.com/path'], $result->getData());
}
}