summaryrefslogtreecommitdiffstats
path: root/tests/settings
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2015-07-28 10:06:26 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2015-07-29 10:07:01 +0200
commit72ba67815ed15aac9d9511504f61f8c5fa73bff4 (patch)
treebaf8b4f9b0606a4a37ddb1c7ce3906d1a87cb3c4 /tests/settings
parente77b2e53179d24deee1fe720f7a60b5db6f5c502 (diff)
downloadnextcloud-server-72ba67815ed15aac9d9511504f61f8c5fa73bff4.tar.gz
nextcloud-server-72ba67815ed15aac9d9511504f61f8c5fa73bff4.zip
Display warning in security & setup warnings if php version is EOL
Diffstat (limited to 'tests/settings')
-rw-r--r--tests/settings/controller/CheckSetupControllerTest.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/settings/controller/CheckSetupControllerTest.php b/tests/settings/controller/CheckSetupControllerTest.php
index 6096aae8652..62fedd6dd6d 100644
--- a/tests/settings/controller/CheckSetupControllerTest.php
+++ b/tests/settings/controller/CheckSetupControllerTest.php
@@ -31,11 +31,24 @@ use OC_Util;
use Test\TestCase;
/**
+ * Mock version_compare
+ * @param string $version1
+ * @param string $version2
+ * @return int
+ */
+function version_compare($version1, $version2) {
+ return CheckSetupControllerTest::$version_compare;
+}
+
+/**
* Class CheckSetupControllerTest
*
* @package OC\Settings\Controller
*/
class CheckSetupControllerTest extends TestCase {
+ /** @var int */
+ public static $version_compare;
+
/** @var CheckSetupController */
private $checkSetupController;
/** @var IRequest */
@@ -209,6 +222,33 @@ class CheckSetupControllerTest extends TestCase {
);
}
+ public function testIsPhpSupportedFalse() {
+ self::$version_compare = -1;
+
+ $this->assertEquals(
+ ['eol' => true, 'version' => PHP_VERSION],
+ self::invokePrivate($this->checkSetupController, 'isPhpSupported')
+ );
+ }
+
+ public function testIsPhpSupportedTrue() {
+ self::$version_compare = 0;
+
+ $this->assertEquals(
+ ['eol' => false, 'version' => PHP_VERSION],
+ self::invokePrivate($this->checkSetupController, 'isPhpSupported')
+ );
+
+
+ self::$version_compare = 1;
+
+ $this->assertEquals(
+ ['eol' => false, 'version' => PHP_VERSION],
+ self::invokePrivate($this->checkSetupController, 'isPhpSupported')
+ );
+
+ }
+
public function testCheck() {
$this->config->expects($this->at(0))
->method('getSystemValue')
@@ -244,6 +284,7 @@ class CheckSetupControllerTest extends TestCase {
->method('linkToDocs')
->with('admin-security')
->willReturn('https://doc.owncloud.org/server/8.1/admin_manual/configuration_server/hardening.html');
+ self::$version_compare = -1;
$expected = new DataResponse(
[
@@ -254,6 +295,10 @@ class CheckSetupControllerTest extends TestCase {
'isUrandomAvailable' => self::invokePrivate($this->checkSetupController, 'isUrandomAvailable'),
'securityDocs' => 'https://doc.owncloud.org/server/8.1/admin_manual/configuration_server/hardening.html',
'isUsedTlsLibOutdated' => '',
+ 'phpSupported' => [
+ 'eol' => true,
+ 'version' => PHP_VERSION
+ ]
]
);
$this->assertEquals($expected, $this->checkSetupController->check());