diff options
Diffstat (limited to 'apps/federation/tests/DAV/FedAuthTest.php')
-rw-r--r-- | apps/federation/tests/DAV/FedAuthTest.php | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/apps/federation/tests/DAV/FedAuthTest.php b/apps/federation/tests/DAV/FedAuthTest.php index 3a801766d85..c95d3852b48 100644 --- a/apps/federation/tests/DAV/FedAuthTest.php +++ b/apps/federation/tests/DAV/FedAuthTest.php @@ -1,50 +1,31 @@ <?php + +declare(strict_types=1); /** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Morris Jobke <hey@morrisjobke.de> - * @author Thomas Müller <thomas.mueller@tmit.eu> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * 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, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * + * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only */ namespace OCA\Federation\Tests\DAV; use OCA\Federation\DAV\FedAuth; use OCA\Federation\DbHandler; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class FedAuthTest extends TestCase { - /** - * @dataProvider providesUser - * - * @param array $expected - * @param string $user - * @param string $password - */ - public function testFedAuth($expected, $user, $password) { - /** @var DbHandler | \PHPUnit\Framework\MockObject\MockObject $db */ - $db = $this->getMockBuilder('OCA\Federation\DbHandler')->disableOriginalConstructor()->getMock(); + #[\PHPUnit\Framework\Attributes\DataProvider('providesUser')] + public function testFedAuth(bool $expected, string $user, string $password): void { + /** @var DbHandler&MockObject $db */ + $db = $this->createMock(DbHandler::class); $db->method('auth')->willReturn(true); $auth = new FedAuth($db); - $result = $this->invokePrivate($auth, 'validateUserPass', [$user, $password]); + $result = self::invokePrivate($auth, 'validateUserPass', [$user, $password]); $this->assertEquals($expected, $result); } - public function providesUser() { + public static function providesUser(): array { return [ [true, 'system', '123456'] ]; |