summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2016-11-21 17:17:02 +0100
committerGitHub <noreply@github.com>2016-11-21 17:17:02 +0100
commitcd24010fa4199e8ef39b831f6f27138504a9c9d6 (patch)
tree01815b38c27a4d876a015aa028feca61d479c3bc /tests
parentefdef8f801bd33b5c2e4d982947a4ff41e2514ab (diff)
parent0048b3aa2e70b2e9d2f1fbb6adb82af31b13f95a (diff)
downloadnextcloud-server-cd24010fa4199e8ef39b831f6f27138504a9c9d6.tar.gz
nextcloud-server-cd24010fa4199e8ef39b831f6f27138504a9c9d6.zip
Merge pull request #2214 from nextcloud/remove-logging
remove old logging section
Diffstat (limited to 'tests')
-rw-r--r--tests/Settings/Controller/LogSettingsControllerTest.php89
-rw-r--r--tests/lib/Settings/Admin/LoggingTest.php91
-rw-r--r--tests/lib/Settings/ManagerTest.php1
3 files changed, 0 insertions, 181 deletions
diff --git a/tests/Settings/Controller/LogSettingsControllerTest.php b/tests/Settings/Controller/LogSettingsControllerTest.php
deleted file mode 100644
index 27ae9328d1f..00000000000
--- a/tests/Settings/Controller/LogSettingsControllerTest.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-/**
- * @author Georg Ehrke
- * @copyright 2014 Georg Ehrke <georg@ownCloud.com>
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-namespace Tests\Settings\Controller;
-
-use \OC\Settings\Application;
-use OC\Settings\Controller\LogSettingsController;
-use OCP\AppFramework\Http\StreamResponse;
-use OCP\IConfig;
-use OCP\IL10N;
-use OCP\IRequest;
-
-/**
- * @package Tests\Settings\Controller
- */
-class LogSettingsControllerTest extends \Test\TestCase {
-
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
- private $config;
-
- /** @var LogSettingsController */
- private $logSettingsController;
-
- protected function setUp() {
- parent::setUp();
-
- $this->config = $this->createMock(IConfig::class);
- $l = $this->createMock(IL10N::class);
- $l->method('t')
- ->will($this->returnCallback(function($text, $parameters = []) {
- return vsprintf($text, $parameters);
- }));
- $this->logSettingsController = new LogSettingsController(
- 'settings',
- $this->createMock(IRequest::class),
- $this->config,
- $l
- );
- }
-
- /**
- * @dataProvider logLevelData
- */
- public function testSetLogLevel($level, $inRange) {
- if ($inRange) {
- $this->config->expects($this->once())
- ->method('setSystemValue')
- ->with('loglevel', $level);
- }
-
- $response = $this->logSettingsController->setLogLevel($level)->getData();
-
- if ($inRange) {
- $expectedResponse = ['level' => $level];
- } else {
- $expectedResponse = ['message' => 'log-level out of allowed range'];
- }
-
- $this->assertSame($expectedResponse, $response);
- }
-
- public function logLevelData() {
- return [
- [-1, false],
- [0, true],
- [1, true],
- [2, true],
- [3, true],
- [4, true],
- [5, false],
- ];
- }
-
- public function testDownload() {
- $response = $this->logSettingsController->download();
-
- $this->assertInstanceOf('\OCP\AppFramework\Http\StreamResponse', $response);
- $headers = $response->getHeaders();
- $this->assertEquals('application/octet-stream', $headers['Content-Type']);
- $this->assertEquals('attachment; filename="nextcloud.log"', $headers['Content-Disposition']);
- }
-}
diff --git a/tests/lib/Settings/Admin/LoggingTest.php b/tests/lib/Settings/Admin/LoggingTest.php
deleted file mode 100644
index 181553d3894..00000000000
--- a/tests/lib/Settings/Admin/LoggingTest.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\Logging;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
-use Test\TestCase;
-use OC\Log\File as LogFile;
-
-class LoggingTest extends TestCase {
- /** @var Logging */
- private $admin;
- /** @var IConfig */
- private $config;
-
- public function setUp() {
- parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
-
- $this->admin = new Logging(
- $this->config
- );
- }
-
- public function testGetForm() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('log_type', 'file')
- ->willReturn('owncloud');
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('loglevel', 2)
- ->willReturn(3);
-
- $numEntriesToLoad = 5;
- $entries = LogFile::getEntries($numEntriesToLoad + 1);
- $entriesRemaining = count($entries) > $numEntriesToLoad;
- $entries = array_slice($entries, 0, $numEntriesToLoad);
-
- $logFileExists = file_exists(LogFile::getLogFilePath()) ;
- $logFileSize = $logFileExists ? filesize(LogFile::getLogFilePath()) : 0;
-
- $expected = new TemplateResponse(
- 'settings',
- 'admin/logging',
- [
- 'loglevel' => 3,
- 'entries' => $entries,
- 'entriesremain' => $entriesRemaining,
- 'doesLogFileExist' => $logFileExists,
- 'logFileSize' => $logFileSize,
- 'showLog' => true,
- ],
- ''
- );
-
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- public function testGetSection() {
- $this->assertSame('logging', $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 942a2bb63e7..150609499ad 100644
--- a/tests/lib/Settings/ManagerTest.php
+++ b/tests/lib/Settings/ManagerTest.php
@@ -177,7 +177,6 @@ class ManagerTest extends TestCase {
0 => [new Section('server', 'Server settings', 0)],
5 => [new Section('sharing', 'Sharing', 0)],
45 => [new Section('encryption', 'Encryption', 0)],
- 90 => [new Section('logging', 'Logging', 0)],
98 => [new Section('additional', 'Additional settings', 0)],
99 => [new Section('tips-tricks', 'Tips & tricks', 0)],
], $this->manager->getAdminSections());