aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Settings/ApplicationTest.php2
-rw-r--r--tests/Settings/Controller/SecuritySettingsControllerTest.php72
-rw-r--r--tests/data/app/description-multi-lang.xml8
-rw-r--r--tests/data/app/description-single-lang.xml7
-rw-r--r--tests/lib/AppTest.php14
5 files changed, 29 insertions, 74 deletions
diff --git a/tests/Settings/ApplicationTest.php b/tests/Settings/ApplicationTest.php
index 8346f668d9d..31391a8fac6 100644
--- a/tests/Settings/ApplicationTest.php
+++ b/tests/Settings/ApplicationTest.php
@@ -33,7 +33,6 @@ use OC\Settings\Controller\CheckSetupController;
use OC\Settings\Controller\GroupsController;
use OC\Settings\Controller\LogSettingsController;
use OC\Settings\Controller\MailSettingsController;
-use OC\Settings\Controller\SecuritySettingsController;
use OC\Settings\Controller\UsersController;
use OC\Settings\Middleware\SubadminMiddleware;
use OCP\AppFramework\Controller;
@@ -76,7 +75,6 @@ class ApplicationTest extends TestCase {
[GroupsController::class, Controller::class],
[LogSettingsController::class, Controller::class],
[MailSettingsController::class, Controller::class],
- [SecuritySettingsController::class, Controller::class],
[UsersController::class, Controller::class],
[SubadminMiddleware::class, Middleware::class],
diff --git a/tests/Settings/Controller/SecuritySettingsControllerTest.php b/tests/Settings/Controller/SecuritySettingsControllerTest.php
deleted file mode 100644
index 75d580d9f85..00000000000
--- a/tests/Settings/Controller/SecuritySettingsControllerTest.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-/**
- * @author Lukas Reschke
- * @copyright 2014 Lukas Reschke lukas@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\SecuritySettingsController;
-use OCP\IConfig;
-use OCP\IRequest;
-
-/**
- * @package Tests\Settings\Controller
- */
-class SecuritySettingsControllerTest extends \Test\TestCase {
-
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
- private $config;
-
- /** @var SecuritySettingsController */
- private $securitySettingsController;
-
- protected function setUp() {
- parent::setUp();
-
- $this->config = $this->createMock(IConfig::class);
- $this->securitySettingsController = new SecuritySettingsController(
- 'settings',
- $this->createMock(IRequest::class),
- $this->config
- );
- }
-
- public function testTrustedDomainsWithExistingValues() {
- $this->config
- ->expects($this->once())
- ->method('setSystemValue')
- ->with('trusted_domains', array('owncloud.org', 'owncloud.com', 'newdomain.com'));
- $this->config
- ->expects($this->once())
- ->method('getSystemValue')
- ->with('trusted_domains')
- ->will($this->returnValue(array('owncloud.org', 'owncloud.com')));
-
- $response = $this->securitySettingsController->trustedDomains('newdomain.com');
- $expectedResponse = array('status' => 'success');
-
- $this->assertSame($expectedResponse, $response);
- }
-
- public function testTrustedDomainsEmpty() {
- $this->config
- ->expects($this->once())
- ->method('setSystemValue')
- ->with('trusted_domains', array('newdomain.com'));
- $this->config
- ->expects($this->once())
- ->method('getSystemValue')
- ->with($this->equalTo('trusted_domains'), $this->equalTo([]))
- ->willReturn([]);
-
- $response = $this->securitySettingsController->trustedDomains('newdomain.com');
- $expectedResponse = array('status' => 'success');
-
- $this->assertSame($expectedResponse, $response);
- }
-}
diff --git a/tests/data/app/description-multi-lang.xml b/tests/data/app/description-multi-lang.xml
new file mode 100644
index 00000000000..e7eee3bcb8b
--- /dev/null
+++ b/tests/data/app/description-multi-lang.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<info>
+ <id>files_encryption</id>
+ <name>Server-side Encryption</name>
+ <description lang="en">English</description>
+ <description lang="de">German</description>
+ <licence>AGPL</licence>
+</info>
diff --git a/tests/data/app/description-single-lang.xml b/tests/data/app/description-single-lang.xml
new file mode 100644
index 00000000000..5fb1ba07e8e
--- /dev/null
+++ b/tests/data/app/description-single-lang.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<info>
+ <id>files_encryption</id>
+ <name>Server-side Encryption</name>
+ <description lang="en">English</description>
+ <licence>AGPL</licence>
+</info>
diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php
index 04729303847..1334aa62f13 100644
--- a/tests/lib/AppTest.php
+++ b/tests/lib/AppTest.php
@@ -9,6 +9,7 @@
namespace Test;
+use OC\App\InfoParser;
use OC\AppConfig;
use OCP\IAppConfig;
@@ -592,5 +593,18 @@ class AppTest extends \Test\TestCase {
public function testParseAppInfo(array $data, array $expected) {
$this->assertSame($expected, \OC_App::parseAppInfo($data));
}
+
+ public function testParseAppInfoL10N() {
+ $parser = new InfoParser();
+ $data = $parser->parse(\OC::$SERVERROOT. "/tests/data/app/description-multi-lang.xml");
+ $this->assertEquals('English', \OC_App::parseAppInfo($data, 'en')['description']);
+ $this->assertEquals('German', \OC_App::parseAppInfo($data, 'de')['description']);
+ }
+
+ public function testParseAppInfoL10NSingleLanguage() {
+ $parser = new InfoParser();
+ $data = $parser->parse(\OC::$SERVERROOT. "/tests/data/app/description-single-lang.xml");
+ $this->assertEquals('English', \OC_App::parseAppInfo($data, 'en')['description']);
+ }
}