Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-09-15 23:53:23 +0300
committerGitHub <noreply@github.com>2022-09-15 23:53:23 +0300
commitb9cd65291a74adf18112014ccc0c6ecfaed64694 (patch)
treecdace11cfcb276000424a84d8790bada102e49ef /apps
parentd39f047af210245adcd877baee090f6cc4a8f40c (diff)
parent954f4940cf53b4ed6acda7331c0c1b5d34b888f2 (diff)
Merge pull request #34098 from nextcloud/fix/test/updatenotifications
Fix test update notification
Diffstat (limited to 'apps')
-rw-r--r--apps/updatenotification/tests/Settings/AdminTest.php43
1 files changed, 24 insertions, 19 deletions
diff --git a/apps/updatenotification/tests/Settings/AdminTest.php b/apps/updatenotification/tests/Settings/AdminTest.php
index 489679dfabd..784e56e79ed 100644
--- a/apps/updatenotification/tests/Settings/AdminTest.php
+++ b/apps/updatenotification/tests/Settings/AdminTest.php
@@ -42,6 +42,7 @@ use OCP\L10N\ILanguageIterator;
use OCP\Support\Subscription\IRegistry;
use OCP\UserInterface;
use OCP\User\Backend\ICountUsersBackend;
+use OCP\AppFramework\Services\IInitialState;
use OCP\Util;
use OC\User\Backend;
use Psr\Log\LoggerInterface;
@@ -66,6 +67,8 @@ class AdminTest extends TestCase {
private $userManager;
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
+ /** IInitialState|\PHPUnit\Framework\MockObject\MockObject */
+ private $initialState;
protected function setUp(): void {
parent::setUp();
@@ -78,6 +81,7 @@ class AdminTest extends TestCase {
$this->subscriptionRegistry = $this->createMock(IRegistry::class);
$this->userManager = $this->createMock(IUserManager::class);
$this->logger = $this->createMock(LoggerInterface::class);
+ $this->initialState = $this->createMock(IInitialState::class);
$this->admin = new Admin(
$this->config,
@@ -87,7 +91,8 @@ class AdminTest extends TestCase {
$this->l10nFactory,
$this->subscriptionRegistry,
$this->userManager,
- $this->logger
+ $this->logger,
+ $this->initialState
);
}
@@ -187,8 +192,9 @@ class AdminTest extends TestCase {
->method('delegateHasValidSubscription')
->willReturn(true);
- $params = [
- 'json' => json_encode([
+ $this->initialState->expects($this->once())
+ ->method('provideInitialState')
+ ->with('data', [
'isNewVersionAvailable' => true,
'isUpdateChecked' => true,
'lastChecked' => 'LastCheckedReturnValue',
@@ -205,13 +211,12 @@ class AdminTest extends TestCase {
'isDefaultUpdateServerURL' => true,
'updateServerURL' => 'https://updates.nextcloud.com/updater_server/',
'notifyGroups' => [
- ['value' => 'admin', 'label' => 'Administrators'],
+ ['id' => 'admin', 'displayname' => 'Administrators'],
],
'hasValidSubscription' => true,
- ]),
- ];
+ ]);
- $expected = new TemplateResponse('updatenotification', 'admin', $params, '');
+ $expected = new TemplateResponse('updatenotification', 'admin', [], '');
$this->assertEquals($expected, $this->admin->getForm());
}
@@ -311,8 +316,9 @@ class AdminTest extends TestCase {
->method('delegateHasValidSubscription')
->willReturn(true);
- $params = [
- 'json' => json_encode([
+ $this->initialState->expects($this->once())
+ ->method('provideInitialState')
+ ->with('data', [
'isNewVersionAvailable' => true,
'isUpdateChecked' => true,
'lastChecked' => 'LastCheckedReturnValue',
@@ -329,13 +335,12 @@ class AdminTest extends TestCase {
'isDefaultUpdateServerURL' => false,
'updateServerURL' => 'https://updates.nextcloud.com/updater_server_changed/',
'notifyGroups' => [
- ['value' => 'admin', 'label' => 'Administrators'],
+ ['id' => 'admin', 'displayname' => 'Administrators'],
],
'hasValidSubscription' => true,
- ]),
- ];
+ ]);
- $expected = new TemplateResponse('updatenotification', 'admin', $params, '');
+ $expected = new TemplateResponse('updatenotification', 'admin', [], '');
$this->assertEquals($expected, $this->admin->getForm());
}
@@ -435,8 +440,9 @@ class AdminTest extends TestCase {
->method('delegateHasValidSubscription')
->willReturn(true);
- $params = [
- 'json' => json_encode([
+ $this->initialState->expects($this->once())
+ ->method('provideInitialState')
+ ->with('data', [
'isNewVersionAvailable' => true,
'isUpdateChecked' => true,
'lastChecked' => 'LastCheckedReturnValue',
@@ -453,13 +459,12 @@ class AdminTest extends TestCase {
'isDefaultUpdateServerURL' => true,
'updateServerURL' => 'https://updates.nextcloud.com/customers/ABC-DEF/',
'notifyGroups' => [
- ['value' => 'admin', 'label' => 'Administrators'],
+ ['id' => 'admin', 'displayname' => 'Administrators'],
],
'hasValidSubscription' => true,
- ]),
- ];
+ ]);
- $expected = new TemplateResponse('updatenotification', 'admin', $params, '');
+ $expected = new TemplateResponse('updatenotification', 'admin', [], '');
$this->assertEquals($expected, $this->admin->getForm());
}