Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fix tests syntax: use __construct(), remove strange semi-colomn after…
Browse files Browse the repository at this point in the history
… class creation.
  • Loading branch information
cdujeu committed Oct 20, 2015
1 parent 29fd983 commit 1414837
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 84 deletions.
4 changes: 2 additions & 2 deletions core/src/core/tests/test.AJXPVersion.php
Expand Up @@ -29,10 +29,10 @@
*/
class AJXPVersion extends AbstractTest
{
public function AJXPVersion() { parent::AbstractTest("Pydio version", "Version : ".AJXP_VERSION); }
public function __construct() { parent::AbstractTest("Pydio version", "Version : ".AJXP_VERSION); }
public function doTest()
{
$this->failedLevel = "info";
return FALSE;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.Client.php
Expand Up @@ -29,11 +29,11 @@
*/
class Client extends AbstractTest
{
public function Client() { parent::AbstractTest("Client Browser", "Current client ".$_SERVER['HTTP_USER_AGENT']); }
public function __construct() { parent::AbstractTest("Client Browser", "Current client ".$_SERVER['HTTP_USER_AGENT']); }
public function doTest()
{
$this->testedParams["Client"] = $_SERVER['HTTP_USER_AGENT'];
$this->failedLevel = "info";
return FALSE;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.PHPCLI.php
Expand Up @@ -28,7 +28,7 @@
*/
class PHPCLI extends AbstractTest
{
public function PHPCLI() { parent::AbstractTest("PHP Command Line", "Testing PHP command line (default is php)"); }
public function __construct() { parent::AbstractTest("PHP Command Line", "Testing PHP command line (default is php)"); }
public function doTest()
{
if (!is_writable(AJXP_CACHE_DIR)) {
Expand Down Expand Up @@ -132,4 +132,4 @@ public function doTest()

return $availability;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.PHPDomXML.php
Expand Up @@ -28,7 +28,7 @@
*/
class PHPDomXML extends AbstractTest
{
public function PHPDomXML() { parent::AbstractTest("DOM Xml enabled", "Dom XML is required, you may have to install the php-xml extension."); }
public function __construct() { parent::AbstractTest("DOM Xml enabled", "Dom XML is required, you may have to install the php-xml extension."); }
public function doTest()
{
$this->failedLevel = "error";
Expand All @@ -39,4 +39,4 @@ public function doTest()
$this->testedParams["DOM Enabled"] = "Yes";
return TRUE;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.PHPErrorLevel.php
Expand Up @@ -28,7 +28,7 @@
*/
class PHPErrorLevel extends AbstractTest
{
public function PHPErrorLevel() { parent::AbstractTest("PHP error level", PHPErrorLevel::error2string(error_reporting())); }
public function __construct() { parent::AbstractTest("PHP error level", PHPErrorLevel::error2string(error_reporting())); }
public function doTest()
{
if (error_reporting() & E_NOTICE) {
Expand Down Expand Up @@ -59,4 +59,4 @@ public function error2string($value)
if(($value&$level)==$level) $levels[]=$name;
return implode(' | ',$levels);
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.PHPExif.php
Expand Up @@ -28,7 +28,7 @@
*/
class PHPExif extends AbstractTest
{
public function PHPExif() {
public function __construct() {
parent::AbstractTest("Exif Extension enabled", "Installing php-exif extension is recommended if you plan to handle images");
}
public function doTest()
Expand All @@ -41,4 +41,4 @@ public function doTest()
$this->testedParams["Exif Enabled"] = "Yes";
return TRUE;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.PHPGDVersion.php
Expand Up @@ -28,7 +28,7 @@
*/
class PHPGDVersion extends AbstractTest
{
public function PHPGDVersion() { parent::AbstractTest("PHP GD version", "GD is required for generating thumbnails"); }
public function __construct() { parent::AbstractTest("PHP GD version", "GD is required for generating thumbnails"); }
public function doTest()
{
$this->failedLevel = "warning";
Expand All @@ -39,4 +39,4 @@ public function doTest()
$this->testedParams["GD Enabled"] = "Yes";
return TRUE;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.PHPLimits.php
Expand Up @@ -28,7 +28,7 @@
*/
class PHPLimits extends AbstractTest
{
public function PHPLimits() { parent::AbstractTest("PHP Limits variables", "<b>Testing configs</b>"); }
public function __construct() { parent::AbstractTest("PHP Limits variables", "<b>Testing configs</b>"); }
public function doTest()
{
$this->testedParams["Upload Max Size"] = ini_get("upload_max_filesize");
Expand All @@ -43,4 +43,4 @@ public function doTest()
$this->failedLevel = "info";
return FALSE;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.PHPMCrypt.php
Expand Up @@ -28,7 +28,7 @@
*/
class PHPMCrypt extends AbstractTest
{
public function PHPMCrypt() { parent::AbstractTest("MCrypt enabled", "MCrypt is required by all security functions."); }
public function __construct() { parent::AbstractTest("MCrypt enabled", "MCrypt is required by all security functions."); }
public function doTest()
{
$this->failedLevel = "error";
Expand All @@ -39,4 +39,4 @@ public function doTest()
$this->testedParams["MCrypt Enabled"] = "Yes";
return TRUE;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.PHPOS.php
Expand Up @@ -28,11 +28,11 @@
*/
class PHPOS extends AbstractTest
{
public function PHPOS() { parent::AbstractTest("PHP operating system", "Current operating system ".PHP_OS); }
public function __construct() { parent::AbstractTest("PHP operating system", "Current operating system ".PHP_OS); }
public function doTest()
{
$this->testedParams["Server OS"] = PHP_OS;
$this->failedLevel = "info";
return FALSE;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.PHPSession.php
Expand Up @@ -28,7 +28,7 @@
*/
class PHPSession extends AbstractTest
{
public function PHPSession() { parent::AbstractTest("PHP Session", "<b>Testing configs</b>"); }
public function __construct() { parent::AbstractTest("PHP Session", "<b>Testing configs</b>"); }
public function doTest()
{
$handler = ini_get("session.save_handler");
Expand All @@ -54,4 +54,4 @@ public function doTest()
$this->failedLevel = "info";
return FALSE;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.PHPVersion.php
Expand Up @@ -28,7 +28,7 @@
*/
class PHPVersion extends AbstractTest
{
public function PHPVersion() { parent::AbstractTest("PHP version", "Minimum required version is PHP 5.3.0"); }
public function __construct() { parent::AbstractTest("PHP version", "Minimum required version is PHP 5.3.0"); }
public function doTest()
{
$version = phpversion();
Expand All @@ -42,4 +42,4 @@ public function doTest()
if (floatval($version) < 5.3 && $locale != "C" && $dirSep != '\\') { $this->failedLevel = "warning"; return FALSE; } // PHP4 doesn't work well with foreign encoding
return TRUE;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.PHP_APC.php
Expand Up @@ -28,7 +28,7 @@
*/
class PHP_APC extends AbstractTest
{
public function PHP_APC() { parent::AbstractTest("PHP APC extension", "Pydio framework loads a lot of PHP files at each query, and using a PHP accelerator is greatly recommanded."); }
public function __construct() { parent::AbstractTest("PHP APC extension", "Pydio framework loads a lot of PHP files at each query, and using a PHP accelerator is greatly recommanded."); }
public function doTest()
{
$this->failedLevel = "warning";
Expand All @@ -44,4 +44,4 @@ public function doTest()
$this->testedParams["PHP APC extension loaded"] = "Yes";
return TRUE;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.PHP_OB.php
Expand Up @@ -28,7 +28,7 @@
*/
class PHP_OB extends AbstractTest
{
public function PHP_OB() { parent::AbstractTest("PHP Output Buffer disabled", "You should disable php output_buffering parameter for better performances with Pydio."); }
public function __construct() { parent::AbstractTest("PHP Output Buffer disabled", "You should disable php output_buffering parameter for better performances with Pydio."); }
public function doTest()
{
$this->failedLevel = "warning";
Expand All @@ -44,4 +44,4 @@ public function doTest()
$this->testedParams["PHP Output Buffer disabled"] = "Yes";
return TRUE;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.PHP_magic_quotes.php
Expand Up @@ -28,7 +28,7 @@
*/
class PHP_magic_quotes extends AbstractTest
{
public function PHP_magic_quotes() { parent::AbstractTest("Magic quotes disabled", "Magic quotes need to be disabled, only relevent for php 5.3"); }
public function __construct() { parent::AbstractTest("Magic quotes disabled", "Magic quotes need to be disabled, only relevent for php 5.3"); }
public function doTest()
{
$this->failedLevel = "error";
Expand All @@ -39,4 +39,4 @@ public function doTest()
$this->testedParams["Magic quotes disabled"] = "Yes";
return TRUE;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.SSLEncryption.php
Expand Up @@ -28,7 +28,7 @@
*/
class SSLEncryption extends AbstractTest
{
public function SSLEncryption() { parent::AbstractTest("SSL Encryption", "You are not using SSL encryption, or it was not detected by the server. Be aware that it is strongly recommended to secure all communication of data over the network."); }
public function __construct() { parent::AbstractTest("SSL Encryption", "You are not using SSL encryption, or it was not detected by the server. Be aware that it is strongly recommended to secure all communication of data over the network."); }
public function doTest()
{
// Get the locale
Expand All @@ -45,4 +45,4 @@ public function doTest()
return TRUE;
}
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.ServerEncoding.php
Expand Up @@ -28,7 +28,7 @@
*/
class ServerEncoding extends AbstractTest
{
public function ServerEncoding() { parent::AbstractTest("Server charset encoding", "You must set a correct charset encoding
public function __construct() { parent::AbstractTest("Server charset encoding", "You must set a correct charset encoding
in your locale definition in the form: en_us.UTF-8. Please refer to setlocale man page.
If your detected locale is C, simply type echo \$LANG on your server command line to read the correct value."); }
public function doTest()
Expand Down Expand Up @@ -58,4 +58,4 @@ public function doTest()
}
return TRUE;
}
};
}
17 changes: 2 additions & 15 deletions core/src/core/tests/test.Upload.php
Expand Up @@ -28,7 +28,7 @@
*/
class Upload extends AbstractTest
{
public function Upload() { parent::AbstractTest("Upload particularities", "<b>Testing configs</b>"); }
public function __construct() { parent::AbstractTest("Upload particularities", "<b>Testing configs</b>"); }
public function doTest()
{
$tmpDir = ini_get("upload_tmp_dir");
Expand All @@ -42,7 +42,6 @@ public function doTest()
$this->testedParams["Upload Tmp Dir Writeable"] = @is_writable($tmpDir);
$this->testedParams["PHP Upload Max Size"] = $this->returnBytes(ini_get("upload_max_filesize"));
$this->testedParams["PHP Post Max Size"] = $this->returnBytes(ini_get("post_max_size"));
//$this->testedParams["AJXP Upload Max Size"] = $this->returnBytes($upload_max_size_per_file);
foreach ($this->testedParams as $paramName => $paramValue) {
$this->failedInfo .= "\n$paramName=$paramValue";
}
Expand All @@ -52,20 +51,8 @@ public function doTest()
$this->failedInfo .= "<p class='suggestion'><b>Suggestion</b> : Set the AJXP_TMP_DIR parameter in the <i>conf/bootstrap_conf.php</i> file</p>";
return FALSE;
}
/*
if ($this->testedParams["AJXP Upload Max Size"] > $this->testedParams["PHP Upload Max Size"]) {
$this->failedLevel = "warning";
$this->failedInfo .= "\nAjaxplorer cannot override the PHP setting! Unless you edit your php.ini, your upload will be limited to ".ini_get("upload_max_filesize")." per file.";
return FALSE;
}
if ($this->testedParams["AJXP Upload Max Size"] > $this->testedParams["PHP Post Max Size"]) {
$this->failedLevel = "warning";
$this->failedInfo .= "\nAjaxplorer cannot override the PHP setting! Unless you edit your php.ini, your upload will be limited to ".ini_get("post_max_size")." per file.";
return FALSE;
}
*/

$this->failedLevel = "info";
return FALSE;
}
};
}
4 changes: 2 additions & 2 deletions core/src/core/tests/test.UsersConfig.php
Expand Up @@ -28,12 +28,12 @@
*/
class UsersConfig extends AbstractTest
{
public function UsersConfig() { parent::AbstractTest("Users Configuration", "Current config for users"); }
public function __construct() { parent::AbstractTest("Users Configuration", "Current config for users"); }
public function doTest()
{
$this->testedParams["Users enabled"] = AuthService::usersEnabled();
$this->testedParams["Guest enabled"] = ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth");
$this->failedLevel = "info";
return FALSE;
}
};
}
27 changes: 2 additions & 25 deletions core/src/core/tests/test.Writeability.php
Expand Up @@ -28,33 +28,10 @@
*/
class Writeability extends AbstractTest
{
public function Writeability() { parent::AbstractTest("Required writeable folder", "One of the following folder should be writeable and is not : "); }
public function __construct() { parent::AbstractTest("Required writeable folder", "One of the following folder should be writeable and is not : "); }
public function doTest()
{
//include(AJXP_CONF_PATH."/bootstrap_plugins.php");
$checks = array();
/*
if (isSet($PLUGINS["CONF_DRIVER"])) {
$confDriver = $PLUGINS["CONF_DRIVER"];
if (isSet($confDriver["OPTIONS"]) && isSet($confDriver["OPTIONS"]["REPOSITORIES_FILEPATH"])) {
$checks[] = dirname($confDriver["OPTIONS"]["REPOSITORIES_FILEPATH"]);
}
if (isSet($confDriver["OPTIONS"]) && isSet($confDriver["OPTIONS"]["USERS_DIRPATH"])) {
$checks[] = $confDriver["OPTIONS"]["REPOSITORIES_FILEPATH"];
}
}
if (isset($PLUGINS["AUTH_DRIVER"])) {
$authDriver = $PLUGINS["AUTH_DRIVER"];
if (isset($authDriver["OPTIONS"]) && isSet($authDriver["OPTIONS"]["USERS_FILEPATH"])) {
$checks[] = dirname($authDriver["OPTIONS"]["USERS_FILEPATH"]);
}
}
if (isset($PLUGINS["LOG_DRIVER"])) {
if (isset($PLUGINS["LOG_DRIVER"]["OPTIONS"]) && isSet($PLUGINS["LOG_DRIVER"]["OPTIONS"]["LOG_PATH"])) {
$checks[] = $PLUGINS["LOG_DRIVER"]["OPTIONS"]["LOG_PATH"];
}
}
*/
$checks[] = AJXP_CACHE_DIR;
$checks[] = AJXP_DATA_PATH;
$checked = array();
Expand All @@ -78,4 +55,4 @@ public function doTest()
$this->failedInfo = "[".implode(',<br>', array_values($checked))."]";
return FALSE;
}
};
}
10 changes: 2 additions & 8 deletions core/src/core/tests/test.Zlib.php
Expand Up @@ -28,17 +28,11 @@
*/
class Zlib extends AbstractTest
{
public function Zlib() { parent::AbstractTest("Zlib extension (ZIP)", "Extension enabled : ".((function_exists('gzopen')||function_exists('gzopen64'))?"1":"0")); }
public function __construct() { parent::AbstractTest("Zlib extension (ZIP)", "Extension enabled : ".((function_exists('gzopen')||function_exists('gzopen64'))?"1":"0")); }
public function doTest()
{
$this->testedParams["Zlib Enabled"] = ((function_exists('gzopen')||function_exists('gzopen64'))?"Yes":"No");
$os = PHP_OS;
/*if (stristr($os, "win")!==false && $this->testedParams["Zlib Enabled"]) {
$this->failedLevel = "warning";
$this->failedInfo = "Warning, the zip functions are erraticaly working on Windows, please don't rely too much on them!";
return FALSE;
}*/
$this->failedLevel = "info";
return false;
}
};
}

0 comments on commit 1414837

Please sign in to comment.