|
From: <al...@us...> - 2013-06-24 19:07:15
|
Revision: 11776
http://sourceforge.net/p/xoops/svn/11776
Author: alain91
Date: 2013-06-24 19:07:12 +0000 (Mon, 24 Jun 2013)
Log Message:
-----------
some modifications
Modified Paths:
--------------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_phpunit.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_simpletest.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/init_mini.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/phpunit.xml
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib/XoopsTest.php
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_phpunit.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_phpunit.php 2013-06-24 13:37:21 UTC (rev 11775)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_phpunit.php 2013-06-24 19:07:12 UTC (rev 11776)
@@ -20,12 +20,9 @@
$_SERVER["SERVER_PROTOCOL"]="HTTP/1.1";
$_SERVER["REQUEST_METHOD"]="POST";
$_SERVER["QUERY_STRING"]="";
+ $_SERVER["REQUEST_URI"]="/xoops/UnitTestXoops/xoops_lib/XoopsTest.php";
}
-error_reporting(E_ALL | E_STRICT);
-
-defined('DS') or define('DS', DIRECTORY_SEPARATOR);
-
class MY_UnitTestCase extends PHPUnit_Framework_TestCase
{
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_simpletest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_simpletest.php 2013-06-24 13:37:21 UTC (rev 11775)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_simpletest.php 2013-06-24 19:07:12 UTC (rev 11776)
@@ -1,83 +1,14 @@
<?php
-error_reporting(E_ALL | E_STRICT);
-defined('DS') or define('DS', DIRECTORY_SEPARATOR);
-
-if (!defined("XOOPS_MAINFILE_INCLUDED")) {
- define("XOOPS_MAINFILE_INCLUDED", 1);
-
- // XOOPS Physical Paths
-
- // Physical path to the XOOPS documents (served) directory WITHOUT trailing slash
- define("XOOPS_ROOT_PATH", "D:\MesApp\EasyPHP-2.0b1\www\xoops\htdocs");
-
- // For forward compatibility
- // Physical path to the XOOPS library directory WITHOUT trailing slash
- define("XOOPS_PATH", "D:\MesApp\EasyPHP-2.0b1\www\xoops\htdocs\xoops_lib");
- // Physical path to the XOOPS datafiles (writable) directory WITHOUT trailing slash
- define("XOOPS_VAR_PATH", "D:\MesApp\EasyPHP-2.0b1\www\xoops\htdocs\xoops_data");
- // Alias of XOOPS_PATH, for compatibility, temporary solution
- define("XOOPS_TRUST_PATH", XOOPS_PATH);
-
- // URL Association for SSL and Protocol Compatibility
- $http = 'http://';
- if (!empty($_SERVER['HTTPS'])) {
- $http = ($_SERVER['HTTPS']=='on') ? 'https://' : 'http://';
- }
- define('XOOPS_PROT', $http);
-
- // XOOPS Virtual Path (URL)
- // Virtual path to your main XOOPS directory WITHOUT trailing slash
- // Example: define("XOOPS_URL", "http://url_to_xoops_directory");
- define("XOOPS_URL", "http://localhost/xoops/htdocs");
-
- // Shall be handled later, don't forget!
- define("XOOPS_CHECK_PATH", 0);
- // Protect against external scripts execution if safe mode is not enabled
- if (XOOPS_CHECK_PATH && !@ini_get("safe_mode")) {
- if (function_exists("debug_backtrace")) {
- $xoopsScriptPath = debug_backtrace();
- if (!count($xoopsScriptPath)) {
- die("XOOPS path check: this file cannot be requested directly");
- }
- $xoopsScriptPath = $xoopsScriptPath[0]["file"];
- } else {
- $xoopsScriptPath = isset($_SERVER["PATH_TRANSLATED"]) ? $_SERVER["PATH_TRANSLATED"] : $_SERVER["SCRIPT_FILENAME"];
- }
- if (DIRECTORY_SEPARATOR != "/") {
- // IIS6 may double the \ chars
- $xoopsScriptPath = str_replace(strpos($xoopsScriptPath, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, "/", $xoopsScriptPath);
- }
- if (strcasecmp(substr($xoopsScriptPath, 0, strlen(XOOPS_ROOT_PATH)), str_replace(DIRECTORY_SEPARATOR, "/", XOOPS_ROOT_PATH))) {
- exit("XOOPS path check: Script is not inside XOOPS_ROOT_PATH and cannot run.");
- }
- }
-
- // Secure file
- require XOOPS_VAR_PATH . '/data/secure.php';
-
- define("XOOPS_GROUP_ADMIN", "1");
- define("XOOPS_GROUP_USERS", "2");
- define("XOOPS_GROUP_ANONYMOUS", "3");
-
- // doesn't include include/common.php
-
-}
-
-require_once XOOPS_ROOT_PATH . DS . 'include' . DS . 'defines.php';
-require_once XOOPS_ROOT_PATH . DS . 'include' . DS . 'version.php';
-require_once XOOPS_ROOT_PATH . DS . 'class' . DS . 'xoopsload.php';
-
defined('SIMPLETEST_ROOT_PATH') OR define('SIMPLETEST_ROOT_PATH',XOOPS_ROOT_PATH.'/../simpletest');
-error_reporting(E_ALL);
require_once SIMPLETEST_ROOT_PATH . '/autorun.php';
class MY_UnitTestCase extends UnitTestCase
{
- function assertSame($arg1, $arg2)
+ function assertSame($arg1, $arg2, $msg='')
{
- return $this->assertIdentical($arg1, $arg2);
+ return $this->assertIdentical($arg1, $arg2, $msg);
}
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/init_mini.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/init_mini.php 2013-06-24 13:37:21 UTC (rev 11775)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/init_mini.php 2013-06-24 19:07:12 UTC (rev 11776)
@@ -1,11 +1,79 @@
<?php
+error_reporting(E_ALL | E_STRICT);
+defined('DS') or define('DS', DIRECTORY_SEPARATOR);
+
// needed for phpunit => initializing $_SERVER values
if (empty($_SERVER["HTTP_HOST"])) {
define('IS_PHPUNIT',true);
}
+if (!defined("XOOPS_MAINFILE_INCLUDED")) {
+ define("XOOPS_MAINFILE_INCLUDED", 1);
+ // XOOPS Physical Paths
+
+ // Physical path to the XOOPS documents (served) directory WITHOUT trailing slash
+ define("XOOPS_ROOT_PATH", "D:\MesApp\EasyPHP-2.0b1\www\xoops\htdocs");
+
+ // For forward compatibility
+ // Physical path to the XOOPS library directory WITHOUT trailing slash
+ define("XOOPS_PATH", "D:\MesApp\EasyPHP-2.0b1\www\xoops\htdocs\xoops_lib");
+ // Physical path to the XOOPS datafiles (writable) directory WITHOUT trailing slash
+ define("XOOPS_VAR_PATH", "D:\MesApp\EasyPHP-2.0b1\www\xoops\htdocs\xoops_data");
+ // Alias of XOOPS_PATH, for compatibility, temporary solution
+ define("XOOPS_TRUST_PATH", XOOPS_PATH);
+
+ // URL Association for SSL and Protocol Compatibility
+ $http = 'http://';
+ if (!empty($_SERVER['HTTPS'])) {
+ $http = ($_SERVER['HTTPS']=='on') ? 'https://' : 'http://';
+ }
+ define('XOOPS_PROT', $http);
+
+ // XOOPS Virtual Path (URL)
+ // Virtual path to your main XOOPS directory WITHOUT trailing slash
+ // Example: define("XOOPS_URL", "http://url_to_xoops_directory");
+ define("XOOPS_URL", "http://localhost/xoops/htdocs");
+
+ // Shall be handled later, don't forget!
+ define("XOOPS_CHECK_PATH", 0);
+ // Protect against external scripts execution if safe mode is not enabled
+ if (XOOPS_CHECK_PATH && !@ini_get("safe_mode")) {
+ if (function_exists("debug_backtrace")) {
+ $xoopsScriptPath = debug_backtrace();
+ if (!count($xoopsScriptPath)) {
+ die("XOOPS path check: this file cannot be requested directly");
+ }
+ $xoopsScriptPath = $xoopsScriptPath[0]["file"];
+ } else {
+ $xoopsScriptPath = isset($_SERVER["PATH_TRANSLATED"]) ? $_SERVER["PATH_TRANSLATED"] : $_SERVER["SCRIPT_FILENAME"];
+ }
+ if (DIRECTORY_SEPARATOR != "/") {
+ // IIS6 may double the \ chars
+ $xoopsScriptPath = str_replace(strpos($xoopsScriptPath, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, "/", $xoopsScriptPath);
+ }
+ if (strcasecmp(substr($xoopsScriptPath, 0, strlen(XOOPS_ROOT_PATH)), str_replace(DIRECTORY_SEPARATOR, "/", XOOPS_ROOT_PATH))) {
+ exit("XOOPS path check: Script is not inside XOOPS_ROOT_PATH and cannot run.");
+ }
+ }
+
+ // Secure file
+ require XOOPS_VAR_PATH . '/data/secure.php';
+
+ define("XOOPS_GROUP_ADMIN", "1");
+ define("XOOPS_GROUP_USERS", "2");
+ define("XOOPS_GROUP_ANONYMOUS", "3");
+
+ // doesn't include include/common.php
+
+}
+
+require_once XOOPS_ROOT_PATH . DS . 'include' . DS . 'defines.php';
+require_once XOOPS_ROOT_PATH . DS . 'include' . DS . 'version.php';
+require_once XOOPS_ROOT_PATH . DS . 'class' . DS . 'xoopsload.php';
+
+
if (defined('IS_PHPUNIT')) {
require_once dirname(__FILE__) . '/common_phpunit.php';
} else {
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/phpunit.xml
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/phpunit.xml 2013-06-24 13:37:21 UTC (rev 11775)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/phpunit.xml 2013-06-24 19:07:12 UTC (rev 11776)
@@ -1,41 +1,35 @@
<phpunit
- colors="false"
- verbose="false"
- stopOnError="false"
- stopOnFailure="false"
- stopOnIncomplete="false"
- stopOnSkipped="false"
- bootstrap="bootstrap.php"
- >
+ colors="false"
+ verbose="false"
+ stopOnError="false"
+ stopOnFailure="false"
+ stopOnIncomplete="false"
+ stopOnSkipped="false"
+ bootstrap="bootstrap.php"
+ >
<testsuites>
- <testsuite name="My Test Suite">
- <directory>class</directory>
- <directory>kernel</directory>
- <directory>xoops_lib</directory>
- </testsuite>
+ <testsuite name="My Test Suite">
+ <directory>class</directory>
+ <directory>kernel</directory>
+ </testsuite>
</testsuites>
<groups>
- <exclude>
- <group>slow</group>
- </exclude>
+ <exclude>
+ <group>slow</group>
+ </exclude>
</groups>
<filter>
- <whitelist>
- <directory suffix=".php">../htdocs/class</directory>
- <directory suffix=".php">../htdocs/kernel</directory>
- <directory suffix=".php">../htdocs/xoops_lib</directory>
- <exclude>
- <directory suffix=".php">../htdocs/xoops_lib/HTMLPurifier</directory>
- <directory suffix=".php">../htdocs/xoops_lib/smarty</directory>
- </exclude>
- </whitelist>
+ <whitelist>
+ <directory suffix=".php">../htdocs/class</directory>
+ <directory suffix=".php">../htdocs/kernel</directory>
+ </whitelist>
</filter>
<logging>
- <log type="coverage-html" target="test-report" charset="UTF-8" yui="true" />
+ <log type="coverage-html" target="test-report" charset="UTF-8" yui="true" />
</logging>
</phpunit>
\ No newline at end of file
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib/XoopsTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib/XoopsTest.php 2013-06-24 13:37:21 UTC (rev 11775)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib/XoopsTest.php 2013-06-24 19:07:12 UTC (rev 11776)
@@ -111,6 +111,15 @@
$value = $instance->theme();
$this->assertSame($theme, $value);
+
+ require_once XOOPS_ROOT_PATH . '/modules/system/themes/default/locale/en_US/en_US.php';
+ require_once XOOPS_ROOT_PATH . '/modules/system/themes/default/locale/en_US/locale.php';
+ $value = $instance->theme('default');
+ $this->assertSame($theme, $value);
+
+ $instance->isAdminSide = true;
+ $value = $instance->theme();
+ $this->assertSame($theme, $value);
}
public function test_800()
@@ -768,8 +777,8 @@
{
$instance=Xoops::getInstance();
- $value = $instance->templateTouch('default');
- $this->assertSame(false, $value);
+ $value = $instance->templateTouch(1);
+ $this->assertSame(true, $value);
}
public function test_8300()
|