generated from nextcloud/app_template
-
Notifications
You must be signed in to change notification settings - Fork 0
feat(capabilities): add support capabilities to indicate valid subscription #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
4f5c6be
feat(capabilities): add support capabilities to indicate valid subscr…
Arsalanulhaq 1be57e0
chore(tests): restructure PHPUnit configuration for unit and integrat…
Arsalanulhaq e5478c2
test(capabilities): add integration and unit tests for Capabilities c…
Arsalanulhaq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * SPDX-FileCopyrightText: 2026 STRATO GmbH | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace OCA\NcwTools; | ||
|
|
||
| use OCP\Capabilities\ICapability; | ||
|
|
||
| class Capabilities implements ICapability { | ||
| /** | ||
| * Override support capabilities to always show valid subscription | ||
| * This ensures the support capability is present even if the support app | ||
| * returns an empty array when subscription check fails. | ||
| * | ||
| * @return array{ | ||
| * support: array{ | ||
| * hasValidSubscription: bool, | ||
| * desktopEnterpriseChannel?: string, | ||
| * } | ||
| * } | ||
| */ | ||
| public function getCapabilities(): array { | ||
| return [ | ||
| 'support' => [ | ||
| 'hasValidSubscription' => true, | ||
| 'desktopEnterpriseChannel' => 'stable', | ||
Arsalanulhaq marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ], | ||
| ]; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,90 @@ | ||||||
| <?php | ||||||
|
|
||||||
| /** | ||||||
| * SPDX-FileCopyrightText: 2026 STRATO GmbH | ||||||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||||||
| */ | ||||||
|
|
||||||
| declare(strict_types=1); | ||||||
|
|
||||||
| namespace OCA\NcwTools\Tests\Integration; | ||||||
|
|
||||||
| use OC\CapabilitiesManager; | ||||||
| use OCA\NcwTools\Capabilities; | ||||||
| use Psr\Log\LoggerInterface; | ||||||
| use Test\TestCase; | ||||||
|
|
||||||
| /** | ||||||
| * Integration test to verify that the ncw_tools Capabilities class | ||||||
| * properly overrides the support.hasValidSubscription value in the | ||||||
| * actual Nextcloud capabilities system. | ||||||
| * | ||||||
| * @group DB | ||||||
|
Comment on lines
+21
to
+22
|
||||||
| * | |
| * @group DB |
Arsalanulhaq marked this conversation as resolved.
Show resolved
Hide resolved
Arsalanulhaq marked this conversation as resolved.
Show resolved
Hide resolved
Arsalanulhaq marked this conversation as resolved.
Show resolved
Hide resolved
Arsalanulhaq marked this conversation as resolved.
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- | ||
| - SPDX-FileCopyrightText: 2026 STRATO GmbH | ||
| - SPDX-License-Identifier: AGPL-3.0-or-later | ||
| --> | ||
| <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| bootstrap="bootstrap.php" | ||
| timeoutForSmallTests="900" | ||
| timeoutForMediumTests="900" | ||
| timeoutForLargeTests="900" | ||
| xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" | ||
| cacheDirectory=".phpunit.cache"> | ||
| <testsuite name="NCW Tools Integration Tests"> | ||
| <directory suffix="Test.php">./integration</directory> | ||
| </testsuite> | ||
| <source> | ||
| <include> | ||
| <directory suffix=".php">../appinfo</directory> | ||
| <directory suffix=".php">../lib</directory> | ||
| </include> | ||
| </source> | ||
| </phpunit> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * SPDX-FileCopyrightText: 2026 STRATO GmbH | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace OCA\NcwTools\Tests\Unit; | ||
|
|
||
| use OCA\NcwTools\Capabilities; | ||
| use Test\TestCase; | ||
|
|
||
| class CapabilitiesTest extends TestCase { | ||
| private Capabilities $capabilities; | ||
|
|
||
| protected function setUp(): void { | ||
| parent::setUp(); | ||
| $this->capabilities = new Capabilities(); | ||
| } | ||
|
|
||
| public function testGetCapabilities(): void { | ||
| $expected = [ | ||
| 'support' => [ | ||
| 'hasValidSubscription' => true, | ||
Arsalanulhaq marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 'desktopEnterpriseChannel' => 'stable', | ||
| ], | ||
| ]; | ||
|
|
||
| $this->assertSame($expected, $this->capabilities->getCapabilities()); | ||
| } | ||
|
|
||
| public function testImplementsICapabilityInterface(): void { | ||
| $this->assertInstanceOf(\OCP\Capabilities\ICapability::class, $this->capabilities); | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.