summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-06-12 16:16:29 +0200
committerMorris Jobke <hey@morrisjobke.de>2018-06-13 12:05:38 +0200
commit4a0b7aaf6c80f59552b1da861432476a8ac4c7cf (patch)
tree21f748733edd5fa5c93dc785c8f1b93a931f12e0 /tests
parentc4a2632d9539fb8c406b1027fdb445cea8310ee0 (diff)
downloadnextcloud-server-4a0b7aaf6c80f59552b1da861432476a8ac4c7cf.tar.gz
nextcloud-server-4a0b7aaf6c80f59552b1da861432476a8ac4c7cf.zip
Merge tips & tricks section into setup checks
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/Settings/Controller/AdminSettingsControllerTest.php5
-rw-r--r--tests/Settings/Controller/CheckSetupControllerTest.php11
-rw-r--r--tests/lib/Settings/Admin/TipsTricksTest.php91
-rw-r--r--tests/lib/Settings/ManagerTest.php6
4 files changed, 14 insertions, 99 deletions
diff --git a/tests/Settings/Controller/AdminSettingsControllerTest.php b/tests/Settings/Controller/AdminSettingsControllerTest.php
index d5650b397fa..5bc48803024 100644
--- a/tests/Settings/Controller/AdminSettingsControllerTest.php
+++ b/tests/Settings/Controller/AdminSettingsControllerTest.php
@@ -22,10 +22,9 @@
*/
namespace Tests\Settings\Controller;
-use OC\Settings\Admin\TipsTricks;
+use OC\Settings\Admin\ServerDevNotice;
use OC\Settings\Controller\AdminSettingsController;
use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
use OCP\INavigationManager;
use OCP\IRequest;
use OCP\Settings\IManager;
@@ -88,7 +87,7 @@ class AdminSettingsControllerTest extends TestCase {
->expects($this->once())
->method('getAdminSettings')
->with('test')
- ->willReturn([5 => new TipsTricks($this->getMockBuilder(IConfig::class)->getMock())]);
+ ->willReturn([5 => new ServerDevNotice()]);
$expected = new TemplateResponse('settings', 'settings/frame', ['forms' => ['personal' => [], 'admin' => []], 'content' => '']);
$this->assertEquals($expected, $this->adminSettingsController->index('test'));
diff --git a/tests/Settings/Controller/CheckSetupControllerTest.php b/tests/Settings/Controller/CheckSetupControllerTest.php
index 7760be16499..f0e19e007f2 100644
--- a/tests/Settings/Controller/CheckSetupControllerTest.php
+++ b/tests/Settings/Controller/CheckSetupControllerTest.php
@@ -103,7 +103,7 @@ class CheckSetupControllerTest extends TestCase {
$this->logger,
$this->dispatcher,
])
- ->setMethods(['getCurlVersion', 'isPhpOutdated', 'isOpcacheProperlySetup', 'hasFreeTypeSupport', 'hasMissingIndexes'])->getMock();
+ ->setMethods(['getCurlVersion', 'isPhpOutdated', 'isOpcacheProperlySetup', 'hasFreeTypeSupport', 'hasMissingIndexes', 'isSqliteUsed'])->getMock();
}
public function testIsInternetConnectionWorkingDisabledViaConfig() {
@@ -332,12 +332,19 @@ class CheckSetupControllerTest extends TestCase {
->method('linkToDocs')
->with('admin-php-opcache')
->willReturn('http://docs.example.org/server/go.php?to=admin-php-opcache');
+ $this->urlGenerator->expects($this->at(5))
+ ->method('linkToDocs')
+ ->with('admin-db-conversion')
+ ->willReturn('http://docs.example.org/server/go.php?to=admin-db-conversion');
$this->checkSetupController
->method('hasFreeTypeSupport')
->willReturn(false);
$this->checkSetupController
->method('hasMissingIndexes')
->willReturn([]);
+ $this->checkSetupController
+ ->method('isSqliteUsed')
+ ->willReturn(false);
$expected = new DataResponse(
[
@@ -361,6 +368,8 @@ class CheckSetupControllerTest extends TestCase {
'isSettimelimitAvailable' => true,
'hasFreeTypeSupport' => false,
'hasMissingIndexes' => [],
+ 'isSqliteUsed' => false,
+ 'databaseConversionDocumentation' => 'http://docs.example.org/server/go.php?to=admin-db-conversion',
]
);
$this->assertEquals($expected, $this->checkSetupController->check());
diff --git a/tests/lib/Settings/Admin/TipsTricksTest.php b/tests/lib/Settings/Admin/TipsTricksTest.php
deleted file mode 100644
index 2bbadab52cb..00000000000
--- a/tests/lib/Settings/Admin/TipsTricksTest.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * 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
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace Test\Settings\Admin;
-
-use OC\Settings\Admin\TipsTricks;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
-use Test\TestCase;
-
-class TipsTrickTest extends TestCase {
- /** @var TipsTricks */
- private $admin;
- /** @var IConfig */
- private $config;
-
- public function setUp() {
- parent::setUp();
- $this->config = $this->getMockBuilder(IConfig::class)->getMock();
-
- $this->admin = new TipsTricks(
- $this->config
- );
- }
-
- public function testGetFormWithExcludedGroupsWithSQLite() {
- $this->config
- ->expects($this->once())
- ->method('getSystemValue')
- ->with('dbtype')
- ->willReturn('sqlite');
-
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/tipstricks',
- [
- 'databaseOverload' => true,
- ],
- ''
- );
-
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- public function testGetFormWithExcludedGroupsWithoutSQLite() {
- $this->config
- ->expects($this->once())
- ->method('getSystemValue')
- ->with('dbtype')
- ->willReturn('mysql');
-
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/tipstricks',
- [
- 'databaseOverload' => false,
- ],
- ''
- );
-
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- public function testGetSection() {
- $this->assertSame('tips-tricks', $this->admin->getSection());
- }
-
- public function testGetPriority() {
- $this->assertSame(0, $this->admin->getPriority());
- }
-}
diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php
index 5c4e2fe7a2c..8d268280900 100644
--- a/tests/lib/Settings/ManagerTest.php
+++ b/tests/lib/Settings/ManagerTest.php
@@ -115,7 +115,7 @@ class ManagerTest extends TestCase {
$this->manager->registerSection('admin', \OCA\WorkflowEngine\Settings\Section::class);
- $this->url->expects($this->exactly(7))
+ $this->url->expects($this->exactly(6))
->method('imagePath')
->willReturnMap([
['settings', 'admin.svg', '0'],
@@ -133,7 +133,6 @@ class ManagerTest extends TestCase {
45 => [new Section('encryption', 'Encryption', 0, '3')],
55 => [\OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class)],
98 => [new Section('additional', 'Additional settings', 0, '1')],
- 99 => [new Section('tips-tricks', 'Tips & tricks', 0, '4')],
], $this->manager->getAdminSections());
}
@@ -167,7 +166,7 @@ class ManagerTest extends TestCase {
->method('t')
->will($this->returnArgument(0));
- $this->url->expects($this->exactly(7))
+ $this->url->expects($this->exactly(6))
->method('imagePath')
->willReturnMap([
['settings', 'admin.svg', '0'],
@@ -184,7 +183,6 @@ class ManagerTest extends TestCase {
10 => [new Section('security', 'Security', 0, '3')],
45 => [new Section('encryption', 'Encryption', 0, '3')],
98 => [new Section('additional', 'Additional settings', 0, '1')],
- 99 => [new Section('tips-tricks', 'Tips & tricks', 0, '4')],
], $this->manager->getAdminSections());
}