aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-03-06 13:08:51 +0100
committerJulius Härtl <jus@bitgrid.net>2020-03-10 14:31:27 +0100
commitdbd63222c890127307a0106db5fda35b74929523 (patch)
treeea9512bc91d6829080a3667ed9e80f9b89a1c4e0 /tests
parentf65e36a70cd8f143d71104df59a9d3cfe828515c (diff)
downloadnextcloud-server-dbd63222c890127307a0106db5fda35b74929523.tar.gz
nextcloud-server-dbd63222c890127307a0106db5fda35b74929523.zip
Add system config flag to manually set that a subscription is available
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Support/Subscription/RegistryTest.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/lib/Support/Subscription/RegistryTest.php b/tests/lib/Support/Subscription/RegistryTest.php
index 3793026be0f..3e316792682 100644
--- a/tests/lib/Support/Subscription/RegistryTest.php
+++ b/tests/lib/Support/Subscription/RegistryTest.php
@@ -23,8 +23,10 @@
namespace Test\Support\Subscription;
use OC\Support\Subscription\Registry;
+use OCP\IConfig;
use OCP\Support\Subscription\ISubscription;
use OCP\Support\Subscription\ISupportedApps;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class RegistryTest extends TestCase {
@@ -32,10 +34,14 @@ class RegistryTest extends TestCase {
/** @var Registry */
private $registry;
+ /** @var MockObject|IConfig */
+ private $config;
+
protected function setUp(): void {
parent::setUp();
- $this->registry = new Registry();
+ $this->config = $this->createMock(IConfig::class);
+ $this->registry = new Registry($this->config);
}
/**
@@ -74,6 +80,16 @@ class RegistryTest extends TestCase {
$this->assertSame(true, $this->registry->delegateHasValidSubscription());
}
+ public function testDelegateHasValidSubscriptionConfig() {
+ /* @var ISubscription|\PHPUnit_Framework_MockObject_MockObject $subscription */
+ $this->config->expects($this->once())
+ ->method('getSystemValueBool')
+ ->with('has_valid_subscription')
+ ->willReturn(true);
+
+ $this->assertSame(true, $this->registry->delegateHasValidSubscription());
+ }
+
public function testDelegateHasExtendedSupport() {
/* @var ISubscription|\PHPUnit_Framework_MockObject_MockObject $subscription */
$subscription = $this->createMock(ISubscription::class);