aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/OCS/ProviderTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/OCS/ProviderTest.php')
-rw-r--r--tests/lib/OCS/ProviderTest.php99
1 files changed, 38 insertions, 61 deletions
diff --git a/tests/lib/OCS/ProviderTest.php b/tests/lib/OCS/ProviderTest.php
index f66bd2eab01..87e01d8301b 100644
--- a/tests/lib/OCS/ProviderTest.php
+++ b/tests/lib/OCS/ProviderTest.php
@@ -1,32 +1,22 @@
<?php
+
/**
- * @author Lukas Reschke <lukas@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @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: 2017-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Test\OCS;
use OC\OCS\Provider;
+use OCP\App\IAppManager;
+use OCP\AppFramework\Http\JSONResponse;
+use OCP\IRequest;
class ProviderTest extends \Test\TestCase {
- /** @var \OCP\IRequest */
+ /** @var IRequest */
private $request;
- /** @var \OCP\App\IAppManager */
+ /** @var IAppManager */
private $appManager;
/** @var Provider */
private $ocsProvider;
@@ -39,19 +29,18 @@ class ProviderTest extends \Test\TestCase {
$this->ocsProvider = new Provider('ocs_provider', $this->request, $this->appManager);
}
- public function testBuildProviderListWithoutAnythingEnabled() {
+ public function testBuildProviderListWithoutAnythingEnabled(): void {
$this->appManager
->expects($this->exactly(4))
->method('isEnabledForUser')
- ->withConsecutive(
- ['files_sharing'],
- ['federation'],
- ['activity'],
- ['provisioning_api']
- )
- ->willReturn(false);
-
- $expected = new \OCP\AppFramework\Http\JSONResponse(
+ ->willReturnMap([
+ ['files_sharing', null, false],
+ ['federation', null, false],
+ ['activity', null, false],
+ ['provisioning_api', null, false],
+ ]);
+
+ $expected = new JSONResponse(
[
'version' => 2,
'services' => [
@@ -70,24 +59,18 @@ class ProviderTest extends \Test\TestCase {
$this->assertEquals($expected, $this->ocsProvider->buildProviderList());
}
- public function testBuildProviderListWithSharingEnabled() {
+ public function testBuildProviderListWithSharingEnabled(): void {
$this->appManager
->expects($this->exactly(4))
->method('isEnabledForUser')
- ->withConsecutive(
- ['files_sharing'],
- ['federation'],
- ['activity'],
- ['provisioning_api']
- )
- ->willReturnOnConsecutiveCalls(
- true,
- false,
- false,
- false
- );
-
- $expected = new \OCP\AppFramework\Http\JSONResponse(
+ ->willReturnMap([
+ ['files_sharing', null, true],
+ ['federation', null, false],
+ ['activity', null, false],
+ ['provisioning_api', null, false],
+ ]);
+
+ $expected = new JSONResponse(
[
'version' => 2,
'services' => [
@@ -119,24 +102,18 @@ class ProviderTest extends \Test\TestCase {
$this->assertEquals($expected, $this->ocsProvider->buildProviderList());
}
- public function testBuildProviderListWithFederationEnabled() {
+ public function testBuildProviderListWithFederationEnabled(): void {
$this->appManager
->expects($this->exactly(4))
->method('isEnabledForUser')
- ->withConsecutive(
- ['files_sharing'],
- ['federation'],
- ['activity'],
- ['provisioning_api']
- )
- ->willReturnOnConsecutiveCalls(
- false,
- true,
- false,
- false
- );
-
- $expected = new \OCP\AppFramework\Http\JSONResponse(
+ ->willReturnMap([
+ ['files_sharing', null, false],
+ ['federation', null, true],
+ ['activity', null, false],
+ ['provisioning_api', null, false],
+ ]);
+
+ $expected = new JSONResponse(
[
'version' => 2,
'services' => [
@@ -163,13 +140,13 @@ class ProviderTest extends \Test\TestCase {
$this->assertEquals($expected, $this->ocsProvider->buildProviderList());
}
- public function testBuildProviderListWithEverythingEnabled() {
+ public function testBuildProviderListWithEverythingEnabled(): void {
$this->appManager
->expects($this->any())
->method('isEnabledForUser')
->willReturn(true);
- $expected = new \OCP\AppFramework\Http\JSONResponse(
+ $expected = new JSONResponse(
[
'version' => 2,
'services' => [