|
From: <al...@us...> - 2013-06-15 20:51:17
|
Revision: 11692
http://sourceforge.net/p/xoops/svn/11692
Author: alain91
Date: 2013-06-15 20:51:13 +0000 (Sat, 15 Jun 2013)
Log Message:
-----------
Fix few bugs
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/phpunit.xml
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-15 17:04:36 UTC (rev 11691)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_phpunit.php 2013-06-15 20:51:13 UTC (rev 11692)
@@ -32,17 +32,11 @@
class MY_UnitTestCase extends PHPUnit_Framework_TestCase
{
- function testDummy() // Not really a test but make phpunit happy
- {
- $this->assertTrue(true);
- }
-
function assertIdentical($arg1, $arg2)
{
return $this->assertSame($arg2, $arg1);
}
-
function assertEqual($arg1, $arg2)
{
return $this->assertEquals($arg2, $arg1);
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-15 17:04:36 UTC (rev 11691)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/phpunit.xml 2013-06-15 20:51:13 UTC (rev 11692)
@@ -1,12 +1,16 @@
<phpunit
colors="true"
verbose="true"
+ stopOnError="false"
+ stopOnFailure="false"
+ stopOnIncomplete="false"
+ stopOnSkipped="false"
bootstrap="bootstrap.php"
>
<testsuites>
<testsuite name="My Test Suite">
- <directory>phpunitXoops</directory>
+ <directory>UnitTestXoops</directory>
</testsuite>
</testsuites>
|
|
From: <al...@us...> - 2013-06-16 09:40:59
|
Revision: 11693
http://sourceforge.net/p/xoops/svn/11693
Author: alain91
Date: 2013-06-16 09:40:56 +0000 (Sun, 16 Jun 2013)
Log Message:
-----------
restrict methods to phpunit ones only
modify default directories in phpunit.xml
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/phpunit.xml
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-15 20:51:13 UTC (rev 11692)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_phpunit.php 2013-06-16 09:40:56 UTC (rev 11693)
@@ -32,72 +32,8 @@
class MY_UnitTestCase extends PHPUnit_Framework_TestCase
{
- function assertIdentical($arg1, $arg2)
+
+ function expectError()
{
- return $this->assertSame($arg2, $arg1);
}
-
- function assertEqual($arg1, $arg2)
- {
- return $this->assertEquals($arg2, $arg1);
- }
-
- function assertPattern($arg1, $arg2)
- {
- return $this->assertRegExp($arg1, $arg2);
- }
-
- function expectError($arg1 = null)
- {
- }
-
- function expectException($arg1 = null)
- {
- }
-
-/**
- * base include file for SimpleTest
- * @package SimpleTest
- * @subpackage UnitTester
- * @version $Id: expectation.php 2009 2011-04-28 08:57:25Z pp11 $
- */
-
- /**
- * Tests the expectation. True if the type or
- * class matches the string value.
- * @param string $compare Comparison value.
- * @return boolean True if correct.
- * @access public
- */
- function assertIsA($object, $type, $message='')
- {
- if (class_exists($type, false)) {
- $this->assertInstanceOf($type, $object, $message);
- return true;
- } else {
- $function = 'is_'.$this->canonicalType($type);
- if (is_callable($function)) {
- $this->assertTrue($function($object));
- return true;
- }
- $this->assertTrue(false);
- return true;
- }
- }
-
- /**
- * Coerces type name into a is_*() match.
- * @param string $type User type.
- * @return string Simpler type.
- * @access private
- */
- protected function canonicalType($type) {
- $type = strtolower($type);
- $map = array('boolean' => 'bool');
- if (isset($map[$type])) {
- $type = $map[$type];
- }
- return $type;
- }
-
}
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-15 20:51:13 UTC (rev 11692)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/phpunit.xml 2013-06-16 09:40:56 UTC (rev 11693)
@@ -10,7 +10,8 @@
<testsuites>
<testsuite name="My Test Suite">
- <directory>UnitTestXoops</directory>
+ <directory>class</directory>
+ <directory>kernel</directory>
</testsuite>
</testsuites>
|
|
From: <al...@us...> - 2013-06-16 09:41:39
|
Revision: 11694
http://sourceforge.net/p/xoops/svn/11694
Author: alain91
Date: 2013-06-16 09:41:36 +0000 (Sun, 16 Jun 2013)
Log Message:
-----------
adapt tests to phpunit only
Modified Paths:
--------------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/ModuleMytextsanitizerTest.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/TemplateTest.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/TplfileHandlerTest.php
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/ModuleMytextsanitizerTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/ModuleMytextsanitizerTest.php 2013-06-16 09:40:56 UTC (rev 11693)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/ModuleMytextsanitizerTest.php 2013-06-16 09:41:36 UTC (rev 11694)
@@ -307,6 +307,9 @@
$this->markTestSkipped('');
}
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ */
public function test_620() {
$sanitizer = MyTextSanitizer::getInstance();
$text = 'toto titi tutu tata';
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/TemplateTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/TemplateTest.php 2013-06-16 09:40:56 UTC (rev 11693)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/TemplateTest.php 2013-06-16 09:41:36 UTC (rev 11694)
@@ -29,7 +29,7 @@
public function test_120() {
$object = new $this->myclass();
- $this->assertIsA($object, $this->myclass);
+ $this->assertInstanceOf($this->myclass, $object);
$value = $object->fetchFromData('toto');
$this->assertSame('toto', $value);
}
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/TplfileHandlerTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/TplfileHandlerTest.php 2013-06-16 09:40:56 UTC (rev 11693)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/TplfileHandlerTest.php 2013-06-16 09:41:36 UTC (rev 11694)
@@ -73,7 +73,7 @@
public function test_280() {
$instance=new $this->myclass();
$value=$instance->templateExists('tpl_name','tpl_set');
- $this->assertIdentical($value,false);
+ $this->assertSame(false, $value);
}
}
\ No newline at end of file
|
|
From: <al...@us...> - 2013-06-16 15:17:56
|
Revision: 11697
http://sourceforge.net/p/xoops/svn/11697
Author: alain91
Date: 2013-06-16 15:17:53 +0000 (Sun, 16 Jun 2013)
Log Message:
-----------
Added Paths:
-----------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib/
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib/XoopsTest.php
Added: 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 (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib/XoopsTest.php 2013-06-16 15:17:53 UTC (rev 11697)
@@ -0,0 +1,96 @@
+<?php
+require_once(dirname(__FILE__).'/../init.php');
+
+class XoopsTest extends MY_UnitTestCase
+{
+
+ public function SetUp() {
+ }
+
+ public function test_100() {
+ $instance=Xoops::getInstance();
+ $this->assertInstanceOf('Xoops', $instance);
+
+ $instance2=Xoops::getInstance();
+ $this->assertSame($instance, $instance2);
+
+ $this->assertSame(array(XOOPS_PATH, XOOPS_URL . 'browse.php'), $instance->paths['XOOPS']);
+ $this->assertSame(array(XOOPS_ROOT_PATH, XOOPS_URL), $instance->paths['www']);
+ $this->assertSame(array(XOOPS_VAR_PATH, null), $instance->paths['var']);
+ $this->assertSame(array(XOOPS_PATH, XOOPS_URL . 'browse.php'), $instance->paths['lib']);
+ $this->assertSame(array(XOOPS_ROOT_PATH . '/modules', XOOPS_URL . '/modules'), $instance->paths['modules']);
+ $this->assertSame(array(XOOPS_ROOT_PATH . '/themes', XOOPS_URL . '/themes'), $instance->paths['themes']);
+ $this->assertSame(array(XOOPS_ROOT_PATH . '/media', XOOPS_URL . '/media'), $instance->paths['media']);
+ $this->assertSame(array(XOOPS_PATH, XOOPS_URL . 'browse.php'), $instance->paths['XOOPS']);
+ $this->assertSame(array(XOOPS_PATH, XOOPS_URL . 'browse.php'), $instance->paths['XOOPS']);
+
+ $this->assertSame(null, $instance->sess_handler);
+ $this->assertSame(null, $instance->module);
+ $this->assertTrue(is_array($instance->config));
+ $this->assertTrue(is_array($instance->moduleConfig));
+ $this->assertTrue(is_string($instance->moduleDirname));
+ $this->assertInstanceOf('XoopsUser', $instance->user);
+ $this->assertTrue(is_bool($instance->userIsAdmin));
+ $this->assertTrue(is_null($instance->option) OR is_array($instance->option));
+ $this->assertTrue(is_string($instance->tpl_name));
+ $this->assertTrue(is_bool($instance->isAdminSide));
+ }
+
+ public function test_120() {
+ $instance=Xoops::getInstance();
+ $this->assertInstanceOf('Xoops', $instance);
+
+ $db = $instance->db();
+ $this->assertInstanceOf('XoopsDatabase', $db);
+
+ $db1 = $instance->db();
+ $this->assertSame($db, $db1);
+ }
+
+ public function test_140() {
+ $instance=Xoops::getInstance();
+ $this->assertInstanceOf('Xoops', $instance);
+
+ $value = $instance->preload();
+ $this->assertInstanceOf('XoopsPreload', $value);
+
+ $value1 = $instance->preload();
+ $this->assertSame($value, $value1);
+ }
+
+ public function test_160() {
+ $instance=Xoops::getInstance();
+ $this->assertInstanceOf('Xoops', $instance);
+
+ $value = $instance->registry();
+ $this->assertInstanceOf('Xoops_Registry', $value);
+
+ $value1 = $instance->registry();
+ $this->assertSame($value, $value1);
+ }
+
+ public function test_180() {
+ $instance=Xoops::getInstance();
+ $this->assertInstanceOf('Xoops', $instance);
+
+ $value = $instance->security();
+ $this->assertInstanceOf('XoopsSecurity', $value);
+
+ $value1 = $instance->security();
+ $this->assertSame($value, $value1);
+ }
+
+ public function test_200() {
+ $instance=Xoops::getInstance();
+ $this->assertInstanceOf('Xoops', $instance);
+
+ $tpl = new XoopsTpl();
+
+ $value = $instance->setTpl($tpl);
+ $this->assertSame($tpl, $value);
+
+ $value1 = $instance->Tpl();
+ $this->assertSame($value, $value1);
+ }
+
+}
|
|
From: <al...@us...> - 2013-06-17 19:05:35
|
Revision: 11714
http://sourceforge.net/p/xoops/svn/11714
Author: alain91
Date: 2013-06-17 19:05:31 +0000 (Mon, 17 Jun 2013)
Log Message:
-----------
add tests
fix some bugs
Modified Paths:
--------------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigoptionTest.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
Added Paths:
-----------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigitemHandlerTest.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigitemTest.php
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigitemHandlerTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigitemHandlerTest.php (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigitemHandlerTest.php 2013-06-17 19:05:31 UTC (rev 11714)
@@ -0,0 +1,20 @@
+<?php
+require_once(dirname(__FILE__).'/../init.php');
+
+class ConfigItemHandlerTest extends MY_UnitTestCase
+{
+ var $myclass='XoopsConfigItemHandler';
+
+ public function SetUp() {
+ }
+
+ public function test_100() {
+ $instance=new $this->myclass();
+ $this->assertInstanceOf($this->myclass, $instance);
+ $this->assertRegExp('/^.*config$/', $instance->table);
+ $this->assertSame('XoopsConfigItem', $instance->className);
+ $this->assertSame('conf_id', $instance->keyName);
+ $this->assertSame('conf_name', $instance->identifierName);
+ }
+
+}
\ No newline at end of file
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigitemTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigitemTest.php (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigitemTest.php 2013-06-17 19:05:31 UTC (rev 11714)
@@ -0,0 +1,93 @@
+<?php
+require_once(dirname(__FILE__).'/../init.php');
+
+class ConfigItemTest extends MY_UnitTestCase
+{
+ var $myclass='XoopsConfigItem';
+
+ public function SetUp() {
+ }
+
+ public function test_100() {
+ $instance=new $this->myclass();
+ $this->assertInstanceOf($this->myclass, $instance);
+ $value=$instance->getVars();
+ $this->assertTrue(isset($value['conf_id']));
+ $this->assertTrue(isset($value['conf_modid']));
+ $this->assertTrue(isset($value['conf_catid']));
+ $this->assertTrue(isset($value['conf_name']));
+ $this->assertTrue(isset($value['conf_title']));
+ $this->assertTrue(isset($value['conf_value']));
+ $this->assertTrue(isset($value['conf_desc']));
+ $this->assertTrue(isset($value['conf_formtype']));
+ $this->assertTrue(isset($value['conf_valuetype']));
+ $this->assertTrue(isset($value['conf_order']));
+ }
+
+ public function test_120() {
+ $instance=new $this->myclass();
+ $value = $instance->id();
+ $this->assertSame(null, $value);
+ }
+
+ public function test_140() {
+ $instance=new $this->myclass();
+ $value = $instance->conf_id();
+ $this->assertSame(null, $value);
+ }
+
+ public function test_160() {
+ $instance=new $this->myclass();
+ $value = $instance->conf_modid();
+ $this->assertSame(null, $value);
+ }
+
+ public function test_180() {
+ $instance=new $this->myclass();
+ $value = $instance->conf_catid();
+ $this->assertSame(null, $value);
+ }
+
+ public function test_200() {
+ $instance=new $this->myclass();
+ $value = $instance->conf_name();
+ $this->assertSame(null, $value);
+ }
+
+ public function test_220() {
+ $instance=new $this->myclass();
+ $value = $instance->conf_title();
+ $this->assertSame(null, $value);
+ }
+
+ public function test_240() {
+ $instance=new $this->myclass();
+ $value = $instance->conf_value();
+ $this->assertSame(null, $value);
+ }
+
+ public function test_260() {
+ $instance=new $this->myclass();
+ $value = $instance->conf_desc();
+ $this->assertSame(null, $value);
+ }
+
+ public function test_280() {
+ $instance=new $this->myclass();
+ $value = $instance->conf_formtype();
+ $this->assertSame(null, $value);
+ }
+
+ public function test_300() {
+ $instance=new $this->myclass();
+ $value = $instance->conf_valuetype();
+ $this->assertSame(null, $value);
+ }
+
+ public function test_320() {
+ $instance=new $this->myclass();
+ $value = $instance->conf_order();
+ $this->assertSame(null, $value);
+ }
+
+}
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigoptionTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigoptionTest.php 2013-06-17 17:21:19 UTC (rev 11713)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigoptionTest.php 2013-06-17 19:05:31 UTC (rev 11714)
@@ -41,5 +41,11 @@
$value = $instance->conf_id();
$this->assertSame(0,$value);
}
+
+ public function test_150() {
+ $instance=new $this->myclass();
+ $value = $instance->confop_value();
+ $this->assertSame(null,$value);
+ }
}
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-17 17:21:19 UTC (rev 11713)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/phpunit.xml 2013-06-17 19:05:31 UTC (rev 11714)
@@ -12,6 +12,7 @@
<testsuite name="My Test Suite">
<directory>class</directory>
<directory>kernel</directory>
+ <directory>xoops_lib</directory>
</testsuite>
</testsuites>
@@ -21,8 +22,10 @@
</exclude>
</groups>
+<!--
<logging>
<log type="coverage-html" target="test-reports" 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-17 17:21:19 UTC (rev 11713)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib/XoopsTest.php 2013-06-17 19:05:31 UTC (rev 11714)
@@ -24,12 +24,12 @@
$this->assertSame(array(XOOPS_PATH, XOOPS_URL . 'browse.php'), $instance->paths['XOOPS']);
$this->assertSame(array(XOOPS_PATH, XOOPS_URL . 'browse.php'), $instance->paths['XOOPS']);
- $this->assertSame(null, $instance->sess_handler);
- $this->assertSame(null, $instance->module);
+ $this->assertTrue(is_null($instance->sess_handler));
+ $this->assertTrue(is_null($instance->module));
$this->assertTrue(is_array($instance->config));
$this->assertTrue(is_array($instance->moduleConfig));
$this->assertTrue(is_string($instance->moduleDirname));
- $this->assertInstanceOf('XoopsUser', $instance->user);
+ $this->assertTrue(is_string($instance->user) OR is_object($instance->user));
$this->assertTrue(is_bool($instance->userIsAdmin));
$this->assertTrue(is_null($instance->option) OR is_array($instance->option));
$this->assertTrue(is_string($instance->tpl_name));
|
|
From: <al...@us...> - 2013-06-18 19:04:38
|
Revision: 11715
http://sourceforge.net/p/xoops/svn/11715
Author: alain91
Date: 2013-06-18 19:04:33 +0000 (Tue, 18 Jun 2013)
Log Message:
-----------
Modified Paths:
--------------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/BlockTest.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/SessionHandlerTest.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
Added Paths:
-----------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/Class.tarTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/Class.zipfileTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/CommentrendererTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/RegistryTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/SnoopyTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/TardownloaderTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/XoopslocalTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/XoopsmailerTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/ZipdownloaderTest_.php
Removed Paths:
-------------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/Class.tarTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/Class.zipfileTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/CommentrendererTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/RegistryTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/SnoopyTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/TardownloaderTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/XoopslocalTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/XoopsmailerTest_.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/ZipdownloaderTest_.php
Deleted: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/Class.tarTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/Class.tarTest_.php 2013-06-17 19:05:31 UTC (rev 11714)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/Class.tarTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -1,90 +0,0 @@
-<?php
-require_once('../init.php');
-//require_once(XOOPS_ROOT_PATH.'/class/class.tar.php');
-
-class TestOfTar extends UnitTestCase
-{
- protected $myclass='Tar';
-
- public function SetUp() {
- }
-
- public function test_100() {
- $tar = new $this->myclass();
- //$tar->openTAR();
- $this->assertEqual(true, false);
- }
-
- public function test_120() {
- $tar = new $this->myclass();
- //$tar->appendTAR();
- $this->assertEqual(true, false);
- }
-
- public function test_140() {
- $tar = new $this->myclass();
- //$tar->getFile($filename);
- $this->assertEqual(true, false);
- }
-
- public function test_160() {
- $tar = new $this->myclass();
- //$tar->getDirectory($dirname);
- $this->assertEqual(true, false);
- }
-
- public function test_180() {
- $tar = new $this->myclass();
- //$tar->containsFile($filename);
- $this->assertEqual(true, false);
- }
-
- public function test_200() {
- $tar = new $this->myclass();
- //$tar->containsDirectory($dirname);
- $this->assertEqual(true, false);
- }
-
- public function test_220() {
- $tar = new $this->myclass();
- //$tar->addDirectory($dirname);
- $this->assertEqual(true, false);
- }
-
- public function test_240() {
- $tar = new $this->myclass();
- //$tar->addFile($filename,$binary);
- $this->assertEqual(true, false);
- }
-
- public function test_260() {
- $tar = new $this->myclass();
- //$tar->removeFile($filename);
- $this->assertEqual(true, false);
- }
-
- public function test_280() {
- $tar = new $this->myclass();
- //$tar->removeDirectory($dirname);
- $this->assertEqual(true, false);
- }
-
- public function test_300() {
- $tar = new $this->myclass();
- //$tar->saveTar();
- $this->assertEqual(true, false);
- }
-
- public function test_320() {
- $tar = new $this->myclass();
- //$tar->toTar();
- $this->assertEqual(true, false);
- }
-
- public function test_340() {
- $tar = new $this->myclass();
- //$tar->toTarOutput();
- $this->assertEqual(true, false);
- }
-
-}
Deleted: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/Class.zipfileTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/Class.zipfileTest_.php 2013-06-17 19:05:31 UTC (rev 11714)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/Class.zipfileTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -1,15 +0,0 @@
-<?php
-require_once('../init.php');
-//require_once(XOOPS_ROOT_PATH.'/class/class.zipfile.php');
-
-class TestOfZipfile extends UnitTestCase
-{
- protected $myclass='zipfile';
-
- public function SetUp() {
- }
-
- public function test_100() {
- $this->assertEqual(true, false); //failure by default
- }
-}
Deleted: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/CommentrendererTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/CommentrendererTest_.php 2013-06-17 19:05:31 UTC (rev 11714)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/CommentrendererTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -1,46 +0,0 @@
-<?php
-require_once(dirname(__FILE__).'/../init.php');
-
-class CommentrenderTest extends MY_UnitTestCase
-{
- protected $myclass = 'XoopsCommentRenderer';
- protected $tpl = null;
-
- public function SetUp() {
- $this->tpl = new XoopsTpl();
- $xoops = Xoops::getInstance();
- $xoops->loadLanguage('comment');
- //include_once $xoops->path('include/comment_constants.php');
- }
-
- public function test_100() {
- $renderer = new $this->myclass($this->tpl);
- $this->assertInstanceOf($this->myclass, $renderer);
- }
-
- public function test_120() {
- $renderer = XoopsCommentRenderer::Instance($this->tpl);
- $this->assertInstanceOf($this->myclass, $renderer);
- }
-
- public function test_140() {
- $renderer = XoopsCommentRenderer::getInstance($this->tpl);
- $this->assertInstanceOf($this->myclass, $renderer);
- }
-
- public function test_160() {
- $renderer = XoopsCommentRenderer::getInstance($this->tpl);
- $this->assertInstanceOf($this->myclass, $renderer);
-
- $comment1 = new XoopsComment();
- $comment1->setVar('com_status',XOOPS_COMMENT_ACTIVE);
- $comment2 = new XoopsComment();
- $comment2->setVar('com_status',XOOPS_COMMENT_ACTIVE);
-
- $tmp = array($comment1, $comment2);
- $renderer->setComments($tmp);
-
- $renderer->renderFlatView();
- }
-
-}
Deleted: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/RegistryTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/RegistryTest_.php 2013-06-17 19:05:31 UTC (rev 11714)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/RegistryTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -1,32 +0,0 @@
-<?php
-require_once('../init.php');
-//require_once(XOOPS_ROOT_PATH.'/class/registry.php');
-
-class TestOfRegistry extends UnitTestCase
-{
- protected $myclass = 'XoopsRegistry';
-
- public function SetUp() {
- }
-
- public function tearDown() {
- XoopsRegistry::_unsetInstance();
- }
-
- public function test_100() {
- $value = XoopsRegistry::getInstance();
- $this->assertIsA($value, $this->myclass);
- $value2 = XoopsRegistry::getInstance();
- $this->assertIdentical($value, $value2);
- }
-
- public function test_120() {
- $registry = new $this->myclass(); // Dont use getInstance there
- $this->assertIsA($registry, $this->myclass);
- XoopsRegistry::setInstance($registry);
- $this->assertIdentical($registry::$_registry, $registry);
- $this->expectError();
- XoopsRegistry::setInstance($registry);
- }
-
-}
Deleted: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/SnoopyTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/SnoopyTest_.php 2013-06-17 19:05:31 UTC (rev 11714)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/SnoopyTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -1,14 +0,0 @@
-<?php
-require_once('../init.php');
-//require_once(XOOPS_ROOT_PATH.'/class/snoopy.php');
-
-class TestOfSnoopy extends UnitTestCase
-{
-
- public function SetUp() {
- }
-
- public function test_100() {
- $this->assertEqual(true, false);
- }
-}
Deleted: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/TardownloaderTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/TardownloaderTest_.php 2013-06-17 19:05:31 UTC (rev 11714)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/TardownloaderTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -1,14 +0,0 @@
-<?php
-require_once('../init.php');
-//require_once(XOOPS_ROOT_PATH.'/class/tardownloader.php');
-
-class TestOfTardownloader extends UnitTestCase
-{
-
- public function SetUp() {
- }
-
- public function test_100() {
- $this->assertEqual(true, false);
- }
-}
Deleted: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/XoopslocalTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/XoopslocalTest_.php 2013-06-17 19:05:31 UTC (rev 11714)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/XoopslocalTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -1,14 +0,0 @@
-<?php
-require_once('../init.php');
-//require_once(XOOPS_ROOT_PATH.'/class/xoopslocal.php');
-
-class TestOfXoopslocal extends UnitTestCase
-{
-
- public function SetUp() {
- }
-
- public function test_100() {
- $this->assertEqual(true, false);
- }
-}
Deleted: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/XoopsmailerTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/XoopsmailerTest_.php 2013-06-17 19:05:31 UTC (rev 11714)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/XoopsmailerTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -1,14 +0,0 @@
-<?php
-require_once('../init.php');
-//require_once(XOOPS_ROOT_PATH.'/class/xoopsmailer.php');
-
-class TestOfXoopsmailer extends UnitTestCase
-{
-
- public function SetUp() {
- }
-
- public function test_100() {
- $this->assertEqual(true, false);
- }
-}
Deleted: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/ZipdownloaderTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/ZipdownloaderTest_.php 2013-06-17 19:05:31 UTC (rev 11714)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/ZipdownloaderTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -1,14 +0,0 @@
-<?php
-require_once('../init.php');
-//require_once(XOOPS_ROOT_PATH.'/class/zipdownloader.php');
-
-class TestOfZipdownloader extends UnitTestCase
-{
-
- public function SetUp() {
- }
-
- public function test_100() {
- $this->assertEqual(true, false);
- }
-}
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/Class.tarTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/Class.tarTest_.php (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/Class.tarTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -0,0 +1,90 @@
+<?php
+require_once('../init.php');
+//require_once(XOOPS_ROOT_PATH.'/class/class.tar.php');
+
+class TestOfTar extends UnitTestCase
+{
+ protected $myclass='Tar';
+
+ public function SetUp() {
+ }
+
+ public function test_100() {
+ $tar = new $this->myclass();
+ //$tar->openTAR();
+ $this->assertEqual(true, false);
+ }
+
+ public function test_120() {
+ $tar = new $this->myclass();
+ //$tar->appendTAR();
+ $this->assertEqual(true, false);
+ }
+
+ public function test_140() {
+ $tar = new $this->myclass();
+ //$tar->getFile($filename);
+ $this->assertEqual(true, false);
+ }
+
+ public function test_160() {
+ $tar = new $this->myclass();
+ //$tar->getDirectory($dirname);
+ $this->assertEqual(true, false);
+ }
+
+ public function test_180() {
+ $tar = new $this->myclass();
+ //$tar->containsFile($filename);
+ $this->assertEqual(true, false);
+ }
+
+ public function test_200() {
+ $tar = new $this->myclass();
+ //$tar->containsDirectory($dirname);
+ $this->assertEqual(true, false);
+ }
+
+ public function test_220() {
+ $tar = new $this->myclass();
+ //$tar->addDirectory($dirname);
+ $this->assertEqual(true, false);
+ }
+
+ public function test_240() {
+ $tar = new $this->myclass();
+ //$tar->addFile($filename,$binary);
+ $this->assertEqual(true, false);
+ }
+
+ public function test_260() {
+ $tar = new $this->myclass();
+ //$tar->removeFile($filename);
+ $this->assertEqual(true, false);
+ }
+
+ public function test_280() {
+ $tar = new $this->myclass();
+ //$tar->removeDirectory($dirname);
+ $this->assertEqual(true, false);
+ }
+
+ public function test_300() {
+ $tar = new $this->myclass();
+ //$tar->saveTar();
+ $this->assertEqual(true, false);
+ }
+
+ public function test_320() {
+ $tar = new $this->myclass();
+ //$tar->toTar();
+ $this->assertEqual(true, false);
+ }
+
+ public function test_340() {
+ $tar = new $this->myclass();
+ //$tar->toTarOutput();
+ $this->assertEqual(true, false);
+ }
+
+}
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/Class.zipfileTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/Class.zipfileTest_.php (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/Class.zipfileTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -0,0 +1,15 @@
+<?php
+require_once('../init.php');
+//require_once(XOOPS_ROOT_PATH.'/class/class.zipfile.php');
+
+class TestOfZipfile extends UnitTestCase
+{
+ protected $myclass='zipfile';
+
+ public function SetUp() {
+ }
+
+ public function test_100() {
+ $this->assertEqual(true, false); //failure by default
+ }
+}
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/CommentrendererTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/CommentrendererTest_.php (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/CommentrendererTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -0,0 +1,46 @@
+<?php
+require_once(dirname(__FILE__).'/../init.php');
+
+class CommentrenderTest extends MY_UnitTestCase
+{
+ protected $myclass = 'XoopsCommentRenderer';
+ protected $tpl = null;
+
+ public function SetUp() {
+ $this->tpl = new XoopsTpl();
+ $xoops = Xoops::getInstance();
+ $xoops->loadLanguage('comment');
+ //include_once $xoops->path('include/comment_constants.php');
+ }
+
+ public function test_100() {
+ $renderer = new $this->myclass($this->tpl);
+ $this->assertInstanceOf($this->myclass, $renderer);
+ }
+
+ public function test_120() {
+ $renderer = XoopsCommentRenderer::Instance($this->tpl);
+ $this->assertInstanceOf($this->myclass, $renderer);
+ }
+
+ public function test_140() {
+ $renderer = XoopsCommentRenderer::getInstance($this->tpl);
+ $this->assertInstanceOf($this->myclass, $renderer);
+ }
+
+ public function test_160() {
+ $renderer = XoopsCommentRenderer::getInstance($this->tpl);
+ $this->assertInstanceOf($this->myclass, $renderer);
+
+ $comment1 = new XoopsComment();
+ $comment1->setVar('com_status',XOOPS_COMMENT_ACTIVE);
+ $comment2 = new XoopsComment();
+ $comment2->setVar('com_status',XOOPS_COMMENT_ACTIVE);
+
+ $tmp = array($comment1, $comment2);
+ $renderer->setComments($tmp);
+
+ $renderer->renderFlatView();
+ }
+
+}
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/RegistryTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/RegistryTest_.php (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/RegistryTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -0,0 +1,32 @@
+<?php
+require_once('../init.php');
+//require_once(XOOPS_ROOT_PATH.'/class/registry.php');
+
+class TestOfRegistry extends UnitTestCase
+{
+ protected $myclass = 'XoopsRegistry';
+
+ public function SetUp() {
+ }
+
+ public function tearDown() {
+ XoopsRegistry::_unsetInstance();
+ }
+
+ public function test_100() {
+ $value = XoopsRegistry::getInstance();
+ $this->assertIsA($value, $this->myclass);
+ $value2 = XoopsRegistry::getInstance();
+ $this->assertIdentical($value, $value2);
+ }
+
+ public function test_120() {
+ $registry = new $this->myclass(); // Dont use getInstance there
+ $this->assertIsA($registry, $this->myclass);
+ XoopsRegistry::setInstance($registry);
+ $this->assertIdentical($registry::$_registry, $registry);
+ $this->expectError();
+ XoopsRegistry::setInstance($registry);
+ }
+
+}
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/SnoopyTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/SnoopyTest_.php (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/SnoopyTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -0,0 +1,14 @@
+<?php
+require_once('../init.php');
+//require_once(XOOPS_ROOT_PATH.'/class/snoopy.php');
+
+class TestOfSnoopy extends UnitTestCase
+{
+
+ public function SetUp() {
+ }
+
+ public function test_100() {
+ $this->assertEqual(true, false);
+ }
+}
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/TardownloaderTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/TardownloaderTest_.php (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/TardownloaderTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -0,0 +1,14 @@
+<?php
+require_once('../init.php');
+//require_once(XOOPS_ROOT_PATH.'/class/tardownloader.php');
+
+class TestOfTardownloader extends UnitTestCase
+{
+
+ public function SetUp() {
+ }
+
+ public function test_100() {
+ $this->assertEqual(true, false);
+ }
+}
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/XoopslocalTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/XoopslocalTest_.php (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/XoopslocalTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -0,0 +1,14 @@
+<?php
+require_once('../init.php');
+//require_once(XOOPS_ROOT_PATH.'/class/xoopslocal.php');
+
+class TestOfXoopslocal extends UnitTestCase
+{
+
+ public function SetUp() {
+ }
+
+ public function test_100() {
+ $this->assertEqual(true, false);
+ }
+}
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/XoopsmailerTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/XoopsmailerTest_.php (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/XoopsmailerTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -0,0 +1,14 @@
+<?php
+require_once('../init.php');
+//require_once(XOOPS_ROOT_PATH.'/class/xoopsmailer.php');
+
+class TestOfXoopsmailer extends UnitTestCase
+{
+
+ public function SetUp() {
+ }
+
+ public function test_100() {
+ $this->assertEqual(true, false);
+ }
+}
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/ZipdownloaderTest_.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/ZipdownloaderTest_.php (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class/_archives/ZipdownloaderTest_.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -0,0 +1,14 @@
+<?php
+require_once('../init.php');
+//require_once(XOOPS_ROOT_PATH.'/class/zipdownloader.php');
+
+class TestOfZipdownloader extends UnitTestCase
+{
+
+ public function SetUp() {
+ }
+
+ public function test_100() {
+ $this->assertEqual(true, false);
+ }
+}
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/BlockTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/BlockTest.php 2013-06-17 19:05:31 UTC (rev 11714)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/BlockTest.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -32,6 +32,11 @@
$this->assertTrue(isset($value['bcachetime']));
$this->assertTrue(isset($value['last_modified']));
}
+
+ public function test_110() {
+ $instance=new XoopsBlock(1);
+ $this->assertInstanceOf('XoopsBlock',$instance);
+ }
public function test_120() {
$instance=new XoopsBlock();
@@ -163,18 +168,38 @@
$instance=new XoopsBlock();
$value = $instance->getContent();
$this->assertSame('',$value);
+ $value = $instance->getContent('s','T');
+ $this->assertSame('',$value);
+ $value = $instance->getContent('s','H');
+ $this->assertSame('',$value);
+ $value = $instance->getContent('s','P');
+ $this->assertSame('',$value);
+ $value = $instance->getContent('s','S');
+ $this->assertSame('',$value);
}
public function test_560() {
$instance=new XoopsBlock();
$value = $instance->getOptions();
$this->assertSame(false,$value);
+
+ $instance->assignVar('block_type','C');
+ $value = $instance->getOptions();
+ $this->assertSame(false,$value);
}
public function test_580() {
$instance=new XoopsBlock();
$value = $instance->isCustom();
- $this->assertSame(false,$value);
+ $this->assertFalse($value);
+
+ $instance->assignVar('block_type','C');
+ $value = $instance->isCustom();
+ $this->assertTrue($value);
+
+ $instance->assignVar('block_type','E');
+ $value = $instance->isCustom();
+ $this->assertTrue($value);
}
public function test_600() {
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/SessionHandlerTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/SessionHandlerTest.php 2013-06-17 19:05:31 UTC (rev 11714)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/SessionHandlerTest.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -64,18 +64,28 @@
public function test_230() {
$db=XoopsDatabaseFactory::getDatabaseConnection();
$instance=new $this->myclass($db);
- $value=$instance->gc_force();
- $this->assertSame(null,$value);
+ $expire=time()+10;
+ $value=$instance->gc($expire);
+ $this->assertSame(true,$value);
}
-
+
public function test_240() {
$db=XoopsDatabaseFactory::getDatabaseConnection();
$instance=new $this->myclass($db);
+ for ($i=1; $i<=20; $i++) {
+ $instance->gc_force();
+ }
+ $this->assertTrue(true);
+ }
+
+ public function test_260() {
+ $db=XoopsDatabaseFactory::getDatabaseConnection();
+ $instance=new $this->myclass($db);
$value=$instance->regenerate_id();
$this->assertSame(true,$value);
}
- public function test_260() {
+ public function test_280() {
$db=XoopsDatabaseFactory::getDatabaseConnection();
$instance=new $this->myclass($db);
$value=$instance->update_cookie();
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-17 19:05:31 UTC (rev 11714)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/phpunit.xml 2013-06-18 19:04:33 UTC (rev 11715)
@@ -1,5 +1,5 @@
-<phpunit
- colors="false"
+<phpunit
+ colors="false"
verbose="false"
stopOnError="false"
stopOnFailure="false"
@@ -7,25 +7,35 @@
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>
+ <directory>xoops_lib</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>
+</filter>
+
<logging>
- <log type="coverage-html" target="test-reports" 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-17 19:05:31 UTC (rev 11714)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib/XoopsTest.php 2013-06-18 19:04:33 UTC (rev 11715)
@@ -1,5 +1,5 @@
<?php
-require_once(dirname(__FILE__).'/../init.php');
+require_once(dirname(__FILE__).'/../init_mini.php');
class XoopsTest extends MY_UnitTestCase
{
|
|
From: <al...@us...> - 2013-06-22 20:01:21
|
Revision: 11749
http://sourceforge.net/p/xoops/svn/11749
Author: alain91
Date: 2013-06-22 20:01:17 +0000 (Sat, 22 Jun 2013)
Log Message:
-----------
add tests and other corrections
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.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/BlockHandlerTest.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/BlockTest.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigcategoryHandlerTest.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/GrouppermHandlerTest.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ObjectTest.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/OnlineHandlerTest.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/RanksHandlerTest.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/SessionHandlerTest.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/TplfileHandlerTest.php
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/TplsetHandlerTest.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-22 19:20:33 UTC (rev 11748)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_phpunit.php 2013-06-22 20:01:17 UTC (rev 11749)
@@ -1,8 +1,4 @@
<?php
-// Avoid check proxy (include/common.php line 88) to define constant XOOPS_DB_PROXY
-// because it implies a readonly database connection
-$_SERVER['REQUEST_METHOD'] = 'POST';
-define('XOOPS_XMLRPC',0);
// needed for phpunit => initializing $_SERVER values
if (empty($_SERVER["HTTP_HOST"])) {
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-22 19:20:33 UTC (rev 11748)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_simpletest.php 2013-06-22 20:01:17 UTC (rev 11749)
@@ -3,26 +3,6 @@
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
-// Avoid check proxy (include/common.php line 88) to define constant XOOPS_DB_PROXY
-// because it implies a readonly database connection
-$_SERVER['REQUEST_METHOD'] = 'POST';
-define('XOOPS_XMLRPC',0);
-
-if (!defined('XOOPS_ROOT_PATH')) {
- // Physical path to the XOOPS documents (served) directory WITHOUT trailing slash
- define('XOOPS_ROOT_PATH', dirname(__FILE__).'/../htdocs');
-
- // For forward compatibility
- // Physical path to the XOOPS library directory WITHOUT trailing slash
- define('XOOPS_PATH', XOOPS_ROOT_PATH.'/xoops_lib');
- // Physical path to the XOOPS datafiles (writable) directory WITHOUT trailing slash
- define('XOOPS_VAR_PATH', XOOPS_ROOT_PATH.'/xoops_data');
- // Alias of XOOPS_PATH, for compatibility, temporary solution
- define("XOOPS_TRUST_PATH", XOOPS_PATH);
-
- define('XOOPS_URL', 'http://localhost/xoops/htdocs');
-}
-
defined('SIMPLETEST_ROOT_PATH') OR define('SIMPLETEST_ROOT_PATH',XOOPS_ROOT_PATH.'/../simpletest');
error_reporting(E_ALL);
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/init.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/init.php 2013-06-22 19:20:33 UTC (rev 11748)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/init.php 2013-06-22 20:01:17 UTC (rev 11749)
@@ -7,6 +7,11 @@
if (defined('IS_PHPUNIT')) {
require_once dirname(__FILE__) . '/common_phpunit.php';
+} else {
+ // Avoid check proxy (include/common.php line 88) to define constant XOOPS_DB_PROXY
+ // because it implies a readonly database connection
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ define('XOOPS_XMLRPC',0);
}
require_once dirname(__FILE__) . '/../htdocs/mainfile.php';
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/BlockHandlerTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/BlockHandlerTest.php 2013-06-22 19:20:33 UTC (rev 11748)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/BlockHandlerTest.php 2013-06-22 20:01:17 UTC (rev 11749)
@@ -8,7 +8,7 @@
}
public function test_100() {
- $instance=new XoopsBlockHandler();
+ $instance = new XoopsBlockHandler();
$this->assertInstanceOf('XoopsBlockHandler',$instance);
$this->assertRegExp('/^.*newblocks$/',$instance->table);
$this->assertSame('bid',$instance->keyName);
@@ -21,11 +21,11 @@
}
public function test_120() {
- $block=new XoopsBlock();
+ $block = new XoopsBlock();
$block->setNew();
- $instance=new XoopsBlockHandler();
+ $instance = new XoopsBlockHandler();
$value = $instance->insertBlock($block);
- $bid=$block->bid();
+ $bid = $block->bid();
$this->assertEquals($bid,$value);
$value = $instance->get($bid);
$this->assertEquals($bid,$value->bid());
@@ -36,79 +36,151 @@
}
public function test_160() {
- $instance=new XoopsBlockHandler();
+ $instance = new XoopsBlockHandler();
$value = $instance->getDistinctObjects();
$this->assertTrue(is_array($value));
}
+ public function test_180() {
+ $instance = new XoopsBlockHandler();
+ $criteria = new Criteria('bid');
+ $value = $instance->getDistinctObjects($criteria);
+ $this->assertTrue(is_array($value));
+ }
+
public function test_200() {
- $instance=new XoopsBlockHandler();
+ $instance = new XoopsBlockHandler();
$value = $instance->getNameList();
$this->assertTrue(is_array($value));
}
public function test_220() {
- $instance=new XoopsBlockHandler();
+ $instance = new XoopsBlockHandler();
$value = $instance->getAllBlocksByGroup(1);
$this->assertTrue(is_array($value));
+
+ $value = $instance->getAllBlocksByGroup(1, false);
+ $this->assertTrue(is_array($value));
+
+ $value = $instance->getAllBlocksByGroup(array(1,1,1), false);
+ $this->assertTrue(is_array($value));
+
+ $value = $instance->getAllBlocksByGroup(1, true, XOOPS_SIDEBLOCK_BOTH);
+ $this->assertTrue(is_array($value));
+
+ $value = $instance->getAllBlocksByGroup(1, true, XOOPS_CENTERBLOCK_ALL);
+ $this->assertTrue(is_array($value));
+
+ $value = $instance->getAllBlocksByGroup(1, true, -1);
+ $this->assertTrue(is_array($value));
+
+ $value = $instance->getAllBlocksByGroup(1, true, null, 1);
+ $this->assertTrue(is_array($value));
}
public function test_240() {
- $instance=new XoopsBlockHandler();
+ $instance = new XoopsBlockHandler();
$value = $instance->getAllBlocks();
$this->assertTrue(is_array($value));
+
+ $value = $instance->getAllBlocks('object', true, XOOPS_SIDEBLOCK_BOTH);
+ $this->assertTrue(is_array($value));
+
+ $value = $instance->getAllBlocks('object', true, XOOPS_CENTERBLOCK_ALL);
+ $this->assertTrue(is_array($value));
+
+ $value = $instance->getAllBlocks('object', true, -1);
+ $this->assertTrue(is_array($value));
+
+ $value = $instance->getAllBlocks('object', true, null, 1);
+ $this->assertTrue(is_array($value));
+
+ $value = $instance->getAllBlocks('list');
+ $this->assertTrue(is_array($value));
+
+ $value = $instance->getAllBlocks('id');
+ $this->assertTrue(is_array($value));
}
public function test_260() {
- $block=new XoopsBlock();
$instance=new XoopsBlockHandler();
$value = $instance->getByModule('module');
$this->assertTrue(is_array($value));
+
+ $value = $instance->getByModule('module', false);
+ $this->assertTrue(is_array($value));
}
public function test_280() {
- $instance=new XoopsBlockHandler();
+ $instance = new XoopsBlockHandler();
$value = $instance->getAllByGroupModule(1);
$this->assertTrue(is_array($value));
+
+ $value = $instance->getAllByGroupModule(array(1,1,1));
+ $this->assertTrue(is_array($value));
+
+ $value = $instance->getAllByGroupModule(1, 1);
+ $this->assertTrue(is_array($value));
+
+ $value = $instance->getAllByGroupModule(1, 1, true);
+ $this->assertTrue(is_array($value));
}
public function test_300() {
- $instance=new XoopsBlockHandler();
+ $instance = new XoopsBlockHandler();
$value = $instance->getNonGroupedBlocks();
$this->assertTrue(is_array($value));
+
+ $value = $instance->getNonGroupedBlocks(1);
+ $this->assertTrue(is_array($value));
+
+ $value = $instance->getNonGroupedBlocks(1, true);
+ $this->assertTrue(is_array($value));
+
+ $value = $instance->getNonGroupedBlocks(0, false, true);
+ $this->assertTrue(is_array($value));
}
public function test_320() {
- $instance=new XoopsBlockHandler();
- $value = $instance->countSimilarBlocks('module',1);
- $this->assertSame(0,$value);
+ $instance = new XoopsBlockHandler();
+ $value = $instance->countSimilarBlocks(1, 1);
+ $this->assertEquals(1 ,$value);
+
+ $value = $instance->countSimilarBlocks(1, 1, 'shows_func');
+ $this->assertEquals(0 ,$value);
}
public function test_340() {
- $instance=new XoopsBlockHandler();
- $value = $instance->buildContent(0);
+ $instance = new XoopsBlockHandler();
+ $value = $instance->buildContent(0, 'titi', 'toto');
+ $this->assertSame('tototiti',$value);
+
+ $value = $instance->buildContent(1, 'titi', 'toto');
+ $this->assertSame('tititoto',$value);
+
+ $value = $instance->buildContent(2, 'titi', 'toto');
$this->assertSame('',$value);
}
public function test_360() {
- $instance=new XoopsBlockHandler();
- $title='original';
+ $instance = new XoopsBlockHandler();
+ $title = 'original';
$value = $instance->buildTitle($title);
$this->assertEquals($title,$value);
- $title='original2';
- $new='new';
+ $title = 'original2';
+ $new = 'new';
$value = $instance->buildTitle($title,$new);
$this->assertEquals($new,$value);
}
public function test_380() {
- $instance=new XoopsBlockHandler();
+ $instance = new XoopsBlockHandler();
$value = $instance->getBlockByPerm(null);
$this->assertTrue(empty($value) AND is_array($value));
}
public function test_400() {
- $instance=new XoopsBlockHandler();
+ $instance = new XoopsBlockHandler();
$value = $instance->getBlockByPerm(1);
$this->assertTrue(is_array($value));
}
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/BlockTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/BlockTest.php 2013-06-22 19:20:33 UTC (rev 11748)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/BlockTest.php 2013-06-22 20:01:17 UTC (rev 11749)
@@ -4,11 +4,13 @@
class BlockTest extends MY_UnitTestCase
{
- public function SetUp() {
+ public function SetUp()
+ {
}
- public function test_100() {
- $instance=new XoopsBlock();
+ public function test_100()
+ {
+ $instance = new XoopsBlock();
$this->assertInstanceOf('XoopsBlock',$instance);
$value=$instance->getVars();
$this->assertTrue(isset($value['bid']));
@@ -33,97 +35,113 @@
$this->assertTrue(isset($value['last_modified']));
}
- public function test_110() {
- $instance=new XoopsBlock(1);
+ public function test_110()
+ {
+ $instance = new XoopsBlock(1);
$this->assertInstanceOf('XoopsBlock',$instance);
}
- public function test_120() {
- $instance=new XoopsBlock();
+ public function test_120()
+ {
+ $instance = new XoopsBlock();
$value = $instance->id();
$this->assertSame(null,$value);
}
- public function test_140() {
- $instance=new XoopsBlock();
+ public function test_140()
+ {
+ $instance = new XoopsBlock();
$value = $instance->bid();
$this->assertSame(null,$value);
}
- public function test_160() {
- $instance=new XoopsBlock();
+ public function test_160()
+ {
+ $instance = new XoopsBlock();
$value = $instance->mid();
$this->assertSame(0,$value);
}
- public function test_180() {
- $instance=new XoopsBlock();
+ public function test_180()
+ {
+ $instance = new XoopsBlock();
$value = $instance->func_num();
$this->assertSame(0,$value);
}
- public function test_200() {
- $instance=new XoopsBlock();
+ public function test_200()
+ {
+ $instance = new XoopsBlock();
$value = $instance->options();
$this->assertSame(null,$value);
}
- public function test_220() {
- $instance=new XoopsBlock();
+ public function test_220()
+ {
+ $instance = new XoopsBlock();
$value = $instance->name();
$this->assertSame(null,$value);
}
- public function test_240() {
- $instance=new XoopsBlock();
+ public function test_240()
+ {
+ $instance = new XoopsBlock();
$value = $instance->title();
$this->assertSame(null,$value);
}
- public function test_260() {
- $instance=new XoopsBlock();
+ public function test_260()
+ {
+ $instance = new XoopsBlock();
$value = $instance->content();
$this->assertSame(null,$value);
}
- public function test_280() {
- $instance=new XoopsBlock();
+ public function test_280()
+ {
+ $instance = new XoopsBlock();
$value = $instance->side();
$this->assertSame(0,$value);
}
- public function test_300() {
- $instance=new XoopsBlock();
+ public function test_300()
+ {
+ $instance = new XoopsBlock();
$value = $instance->weight();
$this->assertSame(0,$value);
}
- public function test_320() {
- $instance=new XoopsBlock();
+ public function test_320()
+ {
+ $instance = new XoopsBlock();
$value = $instance->visible();
$this->assertSame(0,$value);
}
- public function test_340() {
- $instance=new XoopsBlock();
+ public function test_340()
+ {
+ $instance = new XoopsBlock();
$value = $instance->block_type();
$this->assertSame(null,$value);
}
- public function test_360() {
- $instance=new XoopsBlock();
+ public function test_360()
+ {
+ $instance = new XoopsBlock();
$value = $instance->c_type();
$this->assertSame(null,$value);
}
- public function test_380() {
- $instance=new XoopsBlock();
+ public function test_380()
+ {
+ $instance = new XoopsBlock();
$value = $instance->isactive();
$this->assertSame(null,$value);
}
- public function test_400() {
- $instance=new XoopsBlock();
+ public function test_400()
+ {
+ $instance = new XoopsBlock();
$value = $instance->dirname();
$this->assertSame(null,$value);
}
@@ -134,38 +152,44 @@
$this->assertSame(null,$value);
}
- public function test_440() {
- $instance=new XoopsBlock();
+ public function test_440()
+ {
+ $instance = new XoopsBlock();
$value = $instance->show_func();
$this->assertSame(null,$value);
}
- public function test_460() {
- $instance=new XoopsBlock();
+ public function test_460()
+ {
+ $instance = new XoopsBlock();
$value = $instance->edit_func();
$this->assertSame(null,$value);
}
- public function test_480() {
- $instance=new XoopsBlock();
+ public function test_480()
+ {
+ $instance = new XoopsBlock();
$value = $instance->template();
$this->assertSame($value,null);
}
- public function test_500() {
- $instance=new XoopsBlock();
+ public function test_500()
+ {
+ $instance = new XoopsBlock();
$value = $instance->bcachetime();
$this->assertSame(0,$value);
}
- public function test_520() {
- $instance=new XoopsBlock();
+ public function test_520()
+ {
+ $instance = new XoopsBlock();
$value = $instance->last_modified();
$this->assertSame(0,$value);
}
- public function test_540() {
- $instance=new XoopsBlock();
+ public function test_540()
+ {
+ $instance = new XoopsBlock();
$value = $instance->getContent();
$this->assertSame('',$value);
$value = $instance->getContent('s','T');
@@ -176,36 +200,94 @@
$this->assertSame('',$value);
$value = $instance->getContent('s','S');
$this->assertSame('',$value);
+ $value = $instance->getContent('e');
+ $this->assertSame('',$value);
+ $value = $instance->getContent('default');
+ $this->assertSame(null,$value);
}
- public function test_560() {
- $instance=new XoopsBlock();
+ public function test_560()
+ {
+ $instance = new XoopsBlock();
$value = $instance->getOptions();
$this->assertSame(false,$value);
+
+ require_once XOOPS_ROOT_PATH.'\modules\page\locale\en_US\en_US.php';
+ require_once XOOPS_ROOT_PATH.'\modules\page\locale\en_US\locale.php';
- $instance->assignVar('block_type','C');
+ $instance->setVar('dirname', 'page');
+ $instance->setVar('func_file', 'page_blocks.php');
+ $instance->setVar('edit_func', 'page_blocks_edit');
+ $instance->setVar('options', 'a|b|c|d|e');
$value = $instance->getOptions();
- $this->assertSame(false,$value);
+ $this->assertTrue(isset($value['text']));
+
+ $instance->setVar('dirname', 'page');
+ $instance->setVar('func_file', 'page_blocks.php');
+ $instance->setVar('edit_func', 'function_not_exists');
+ $instance->setVar('options', 'a|b|c|d|e');
+ $value = $instance->getOptions();
+ $this->assertSame(false, $value);
+
+ $instance->setVar('dirname', 'page');
+ $instance->setVar('func_file', 'file_not_found.php');
+ $instance->setVar('edit_func', 'page_blocks_edit');
+ $instance->setVar('options', 'a|b|c|d|e');
+ $value = $instance->getOptions();
+ $this->assertSame(false, $value);
}
- public function test_580() {
- $instance=new XoopsBlock();
+ public function test_580()
+ {
+ $instance = new XoopsBlock();
$value = $instance->isCustom();
$this->assertFalse($value);
- $instance->assignVar('block_type','C');
+ $instance->setVar('block_type','C');
$value = $instance->isCustom();
$this->assertTrue($value);
- $instance->assignVar('block_type','E');
+ $instance->setVar('block_type','E');
$value = $instance->isCustom();
$this->assertTrue($value);
}
- public function test_600() {
- $instance=new XoopsBlock();
+ public function test_600()
+ {
+ $instance = new XoopsBlock();
$value = $instance->buildBlock();
$this->assertSame(false,$value);
+
+ $instance->setVar('block_type','');
+ $value = $instance->isCustom();
+ $this->assertFalse($value);
+ $value = $instance->buildBlock();
+ $this->assertSame(false,$value);
+
+ $instance->setVar('block_type','C');
+ $value = $instance->isCustom();
+ $this->assertTrue($value);
+
+ $instance->setVar('dirname', 'page');
+ $instance->setVar('func_file', 'page_blocks.php');
+ $instance->setVar('show_func', 'page_blocks_show');
+ $instance->setVar('options', 'a|b|c|d|e');
+ $value = $instance->buildBlock();
+ $this->assertSame(false, $value);
+
+ $instance->setVar('dirname', 'page');
+ $instance->setVar('func_file', 'page_blocks.php');
+ $instance->setVar('show_func', 'function_not_exists');
+ $instance->setVar('options', 'a|b|c|d|e');
+ $value = $instance->buildBlock();
+ $this->assertSame(false, $value);
+
+ $instance->setVar('dirname', 'page');
+ $instance->setVar('func_file', 'file_not_found.php');
+ $instance->setVar('show_func', 'page_blocks_show');
+ $instance->setVar('options', 'a|b|c|d|e');
+ $value = $instance->buildBlock();
+ $this->assertSame(false, $value);
}
}
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigcategoryHandlerTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigcategoryHandlerTest.php 2013-06-22 19:20:33 UTC (rev 11748)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ConfigcategoryHandlerTest.php 2013-06-22 20:01:17 UTC (rev 11749)
@@ -9,7 +9,7 @@
}
public function test_100() {
- $instance=new $this->myclass();
+ $instance = new $this->myclass();
$this->assertInstanceOf($this->myclass,$instance);
$this->assertRegExp('/^.*configcategory$/',$instance->table);
$this->assertSame('XoopsConfigCategory',$instance->className);
@@ -22,5 +22,12 @@
$value=$instance->getCategoryObjects();
$this->assertTrue(is_array($value));
}
+
+ public function test_140() {
+ $instance = new $this->myclass();
+ $criteria = new Criteria('confcat_id');
+ $value=$instance->getCategoryObjects($criteria);
+ $this->assertTrue(is_array($value));
+ }
}
\ No newline at end of file
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/GrouppermHandlerTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/GrouppermHandlerTest.php 2013-06-22 19:20:33 UTC (rev 11748)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/GrouppermHandlerTest.php 2013-06-22 20:01:17 UTC (rev 11749)
@@ -22,6 +22,9 @@
$groupid=1;
$value=$instance->deleteByGroup($groupid);
$this->assertSame(1,$value);
+
+ $value=$instance->deleteByGroup($groupid,1);
+ $this->assertSame(0,$value);
}
public function test_140() {
@@ -29,6 +32,12 @@
$modid=1;
$value=$instance->deleteByModule($modid);
$this->assertSame(0,$value);
+
+ $value=$instance->deleteByModule($modid,'module');
+ $this->assertSame(0,$value);
+
+ $value=$instance->deleteByModule($modid,'module',1);
+ $this->assertSame(0,$value);
}
public function test_160() {
@@ -38,6 +47,15 @@
$groupid=1;
$value=$instance->checkRight($name,$itemid,$groupid);
$this->assertSame(true,$value);
+
+ $value=$instance->checkRight($name,$itemid,$groupid,1,false);
+ $this->assertSame(false,$value);
+
+ $value=$instance->checkRight($name,$itemid,array($groupid,$groupid,$groupid));
+ $this->assertSame(true,$value);
+
+ $value=$instance->checkRight($name,$itemid,array($groupid,$groupid,$groupid), 1 , false);;
+ $this->assertSame(false,$value);
}
public function test_180() {
@@ -55,6 +73,9 @@
$groupid=1;
$value=$instance->getItemIds($name,$groupid);
$this->assertTrue(is_array($value));
+
+ $value=$instance->getItemIds($name,array($groupid,$groupid,$groupid));
+ $this->assertTrue(is_array($value));
}
public function test_220() {
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ObjectTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ObjectTest.php 2013-06-22 19:20:33 UTC (rev 11748)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/ObjectTest.php 2013-06-22 20:01:17 UTC (rev 11749)
@@ -5,27 +5,147 @@
{
var $myclass='XoopsObject';
- public function SetUp() {
+ public function SetUp()
+ {
}
- public function test_120() {
- $instance=new $this->myclass();
- $value=$instance->isNew();
+ public function test_120()
+ {
+ $instance = new $this->myclass();
+ $value = $instance->isNew();
$this->assertSame(false,$value);
- $value=$instance->setNew();
+ $value = $instance->setNew();
$this->assertSame(null,$value);
- $value=$instance->unsetNew();
+ $value = $instance->unsetNew();
$this->assertSame(null,$value);
}
- public function test_140() {
- $instance=new $this->myclass();
- $value=$instance->isDirty();
+ public function test_140()
+ {
+ $instance = new $this->myclass();
+ $value = $instance->isDirty();
$this->assertSame(false,$value);
- $value=$instance->setDirty();
+ $value = $instance->setDirty();
$this->assertSame(null,$value);
- $value=$instance->unsetDirty();
+ $value = $instance->unsetDirty();
$this->assertSame(null,$value);
}
-
+
+ public function test_160()
+ {
+ $instance = new $this->myclass();
+ $instance->initVar('dummyVar', XOBJ_DTYPE_INT, 0);
+ $value = &$instance->vars['dummyVar'];
+ $this->assertSame(XOBJ_DTYPE_INT, $value['data_type']);
+ $this->assertSame(0, $value['value']);
+ $this->assertSame(false, $value['required']);
+ $this->assertSame(null, $value['maxlength']);
+ $this->assertSame(false, $value['changed']);
+ $this->assertSame('', $value['options']);
+
+ $instance->initVar('dummyVar', XOBJ_DTYPE_INT);
+ $this->assertSame(null, $value['value']);
+
+ $instance->initVar('dummyVar', XOBJ_DTYPE_INT, null, true);
+ $this->assertSame(null, $value['value']);
+ $this->assertSame(true, $value['required']);
+
+ $instance->initVar('dummyVar', XOBJ_DTYPE_INT, null, true, 10);
+ $this->assertSame(10, $value['maxlength']);
+ $this->assertSame(false, $value['changed']);
+
+ $instance->initVar('dummyVar', XOBJ_DTYPE_INT, null, false, null, 'options');
+ $this->assertSame('options', $value['options']);
+ $this->assertSame(false, $value['changed']);
+ }
+
+ public function test_180()
+ {
+ $instance = new $this->myclass();
+ $instance->initVar('dummyVar', XOBJ_DTYPE_INT, 0);
+ $value = &$instance->vars['dummyVar'];
+
+ $this->assertSame(0, $value['value']);
+ $instance->assignVar('dummyVar', 1);
+ $this->assertSame(1, $value['value']);
+ $instance->assignVar(null, 1);
+ $this->assertSame(1, $value['value']);
+ $instance->assignVar('dummyVar_not_found', null);
+ $this->assertTrue(!isset($instance->vars['dummyVar_not_found']));
+ }
+
+ public function test_200()
+ {
+ $instance = new $this->myclass();
+ $instance->initVar('dummyVar1', XOBJ_DTYPE_INT, 0);
+ $instance->initVar('dummyVar2', XOBJ_DTYPE_INT, 0);
+ $instance->initVar('dummyVar3', XOBJ_DTYPE_INT, 0);
+
+ $instance->assignVars(array(
+ 'dummyVar1' => 1,
+ 'dummyVar2' => 2,
+ 'dummyVar3' => 3
+ ));
+
+ $this->assertEquals(1, $instance->vars['dummyVar1']['value']);
+ $this->assertEquals(2, $instance->vars['dummyVar2']['value']);
+ $this->assertEquals(3, $instance->vars['dummyVar3']['value']);
+ }
+
+ public function test_220()
+ {
+ $instance = new $this->myclass();
+ $instance->initVar('dummyVar', XOBJ_DTYPE_INT, 0);
+ $value = &$instance->vars['dummyVar'];
+ $this->assertSame(0, $value['value']);
+
+ $instance->setVar('dummyVar', 1);
+ $this->assertSame(1, $value['value']);
+ $this->assertTrue($instance->isDirty());
+
+ $instance->setVar(null, 2);
+ $this->assertSame(1, $value['value']);
+
+ $instance->setVar('dummyVar', null);
+ $this->assertSame(1, $value['value']);
+
+ $instance->setVar('dummyVar', 3, true);
+ $this->assertSame(3, $value['value']);
+ $this->assertSame(true, $value['not_gpc']);
+
+ }
+
+ public function test_240()
+ {
+ $instance = new $this->myclass();
+ $instance->initVar('dummyVar1', XOBJ_DTYPE_INT, 0);
+ $instance->initVar('dummyVar2', XOBJ_DTYPE_INT, 0);
+ $instance->initVar('dummyVar3', XOBJ_DTYPE_INT, 0);
+
+ $instance->setVars(array(
+ 'dummyVar1' => 1,
+ 'dummyVar2' => 2,
+ 'dummyVar3' => 3
+ ));
+
+ $this->assertEquals(1, $instance->vars['dummyVar1']['value']);
+ $this->assertEquals(false, $instance->vars['dummyVar1']['not_gpc']);
+ $this->assertEquals(2, $instance->vars['dummyVar2']['value']);
+ $this->assertEquals(false, $instance->vars['dummyVar2']['not_gpc']);
+ $this->assertEquals(3, $instance->vars['dummyVar3']['value']);
+ $this->assertEquals(false, $instance->vars['dummyVar2']['not_gpc']);
+
+ $instance->setVars(array(
+ 'dummyVar1' => 11,
+ 'dummyVar2' => 22,
+ 'dummyVar3' => 33
+ ), true);
+
+ $this->assertEquals(11, $instance->vars['dummyVar1']['value']);
+ $this->assertEquals(true, $instance->vars['dummyVar1']['not_gpc']);
+ $this->assertEquals(22, $instance->vars['dummyVar2']['value']);
+ $this->assertEquals(true, $instance->vars['dummyVar2']['not_gpc']);
+ $this->assertEquals(33, $instance->vars['dummyVar3']['value']);
+ $this->assertEquals(true, $instance->vars['dummyVar2']['not_gpc']);
+ }
}
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/OnlineHandlerTest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel/OnlineHand...
[truncated message content] |
|
From: <al...@us...> - 2013-06-23 17:20:10
|
Revision: 11770
http://sourceforge.net/p/xoops/svn/11770
Author: alain91
Date: 2013-06-23 17:20:07 +0000 (Sun, 23 Jun 2013)
Log Message:
-----------
add tests + fix initialization
Modified Paths:
--------------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_simpletest.php
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_simpletest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_simpletest.php 2013-06-23 17:00:18 UTC (rev 11769)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_simpletest.php 2013-06-23 17:20:07 UTC (rev 11770)
@@ -3,6 +3,71 @@
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);
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-23 17:00:18 UTC (rev 11769)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib/XoopsTest.php 2013-06-23 17:20:07 UTC (rev 11770)
@@ -1,13 +1,18 @@
<?php
require_once(dirname(__FILE__).'/../init_mini.php');
+require_once XOOPS_ROOT_PATH . '/locale/en_US/en_US.php';
+require_once XOOPS_ROOT_PATH . '/locale/en_US/locale.php';
+
class XoopsTest extends MY_UnitTestCase
{
- public function SetUp() {
+ public function SetUp()
+ {
}
- public function test_100() {
+ public function test_100()
+ {
$instance=Xoops::getInstance();
$this->assertInstanceOf('Xoops', $instance);
@@ -36,9 +41,9 @@
$this->assertTrue(is_bool($instance->isAdminSide));
}
- public function test_120() {
+ public function test_200()
+ {
$instance=Xoops::getInstance();
- $this->assertInstanceOf('Xoops', $instance);
$db = $instance->db();
$this->assertInstanceOf('XoopsDatabase', $db);
@@ -47,9 +52,9 @@
$this->assertSame($db, $db1);
}
- public function test_140() {
+ public function test_300()
+ {
$instance=Xoops::getInstance();
- $this->assertInstanceOf('Xoops', $instance);
$value = $instance->preload();
$this->assertInstanceOf('XoopsPreload', $value);
@@ -58,9 +63,9 @@
$this->assertSame($value, $value1);
}
- public function test_160() {
+ public function test_400()
+ {
$instance=Xoops::getInstance();
- $this->assertInstanceOf('Xoops', $instance);
$value = $instance->registry();
$this->assertInstanceOf('Xoops_Registry', $value);
@@ -69,9 +74,9 @@
$this->assertSame($value, $value1);
}
- public function test_180() {
+ public function test_500()
+ {
$instance=Xoops::getInstance();
- $this->assertInstanceOf('Xoops', $instance);
$value = $instance->security();
$this->assertInstanceOf('XoopsSecurity', $value);
@@ -80,9 +85,9 @@
$this->assertSame($value, $value1);
}
- public function test_200() {
+ public function test_600()
+ {
$instance=Xoops::getInstance();
- $this->assertInstanceOf('Xoops', $instance);
$tpl = new XoopsTpl();
@@ -92,5 +97,700 @@
$value1 = $instance->Tpl();
$this->assertSame($value, $value1);
}
+
+ public function test_700()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->theme();
+ $this->assertInstanceOf('XoopsTheme', $value);
+
+ $theme = new XoopsTheme();
+ $value = $instance->setTheme($theme);
+ $this->assertSame($theme, $value);
+
+ $value = $instance->theme();
+ $this->assertSame($theme, $value);
+ }
+
+ public function test_800()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->path('class');
+ $this->assertTrue(basename($value));
+ $this->assertEquals(XOOPS_ROOT_PATH, dirname($value));
+ }
+
+ public function test_900()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->url('http://localhost/tmp/');
+ $this->assertSame('http://localhost/tmp/', $value);
+
+ $value = $instance->url('http://localhost/tmp');
+ $this->assertSame('http://localhost/tmp', $value);
+
+ $value = $instance->url('tmp');
+ $this->assertSame(XOOPS_URL.'/tmp', $value);
+ }
+
+ public function test_1000()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->buildUrl('http://localhost/tmp/');
+ $this->assertSame('http://localhost/tmp/', $value);
+
+ $value = $instance->url('.');
+ $this->assertSame(XOOPS_URL.'/.', $value);
+ }
+
+ public function test_1100()
+ {
+ $instance=Xoops::getInstance();
+
+ $this->expectError();
+ $value = $instance->pathExists('',E_USER_WARNING);
+ $this->assertSame(false, $value);
+
+ $value = $instance->pathExists('class',E_USER_WARNING);
+ $this->assertSame(false, $value);
+ }
+
+ public function test_1200()
+ {
+ $instance=Xoops::getInstance();
+
+ $instance->gzipCompression();
+ $this->assertSame(true, false);
+ }
+
+ public function test_1300()
+ {
+ $instance=Xoops::getInstance();
+
+ $instance->pathTranslation();
+ $this->assertSame(true, false);
+ }
+
+ public function test_1400()
+ {
+ $instance=Xoops::getInstance();
+
+ $instance->themeSelect();
+ $this->assertSame(true, false);
+ }
+
+ public function test_1500()
+ {
+ $instance=Xoops::getInstance();
+
+ $path = 'path';
+ $value = $instance->getTplInfo($path);
+ $this->assertSame('module', $value['type']);
+ $this->assertSame('system', $value['module']);
+ $this->assertSame('path', $value['file']);
+ $this->assertSame('module:system|path', $value['tpl_name']);
+ }
+
+ public function test_1600()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->header();
+ $this->assertSame(true, $value);
+ }
+
+ public function test_1700()
+ {
+ $instance=Xoops::getInstance();
+
+ //$value = $instance->footer();
+ $this->assertSame(true, false);
+ }
+
+ public function test_1800()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->isModule();
+ $this->assertSame(false, $value);
+ }
+
+ public function test_1900()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->isUser();
+ $this->assertSame(false, $value);
+ }
+
+ public function test_2000()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->isAdmin();
+ $this->assertSame(false, $value);
+ }
+
+ public function test_2100()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->request();
+ $this->assertInstanceOf('Xoops_Request_Http', $value);
+ }
+
+ public function test_2200()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerBlock();
+ $this->assertInstanceOf('XoopsBlockHandler', $value);
+ }
+
+ public function test_2300()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerBlockmodulelink();
+ $this->assertInstanceOf('XoopsBlockmodulelinkHandler', $value);
+ }
+
+ public function test_2400()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerCachemodel();
+ $this->assertInstanceOf('XoopsCachemodelHandler', $value);
+ }
+
+ public function test_2500()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerConfig();
+ $this->assertInstanceOf('XoopsConfigHandler', $value);
+ }
+
+ public function test_2600()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerConfigcategory();
+ $this->assertInstanceOf('XoopsConfigCategoryHandler', $value);
+ }
+
+ public function test_2700()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerConfigitem();
+ $this->assertInstanceOf('XoopsConfigItemHandler', $value);
+ }
+
+ public function test_2800()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerConfigoption();
+ $this->assertInstanceOf('XoopsConfigOptionHandler', $value);
+ }
+
+ public function test_2900()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerGroup();
+ $this->assertInstanceOf('XoopsGroupHandler', $value);
+ }
+
+ public function test_3000()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerGroupperm();
+ $this->assertInstanceOf('XoopsGrouppermHandler', $value);
+ }
+
+ public function test_3100()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerMember();
+ $this->assertInstanceOf('XoopsMemberHandler', $value);
+ }
+
+ public function test_3200()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerMembership();
+ $this->assertInstanceOf('XoopsMembershipHandler', $value);
+ }
+
+ public function test_3300()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerModule();
+ $this->assertInstanceOf('XoopsModuleHandler', $value);
+ }
+
+ public function test_3400()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerOnline();
+ $this->assertInstanceOf('XoopsOnlineHandler', $value);
+ }
+
+ public function test_3500()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerPrivmessage();
+ $this->assertInstanceOf('XoopsPrivmessageHandler', $value);
+ }
+
+ public function test_3600()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerRanks();
+ $this->assertInstanceOf('XoopsRanksHandler', $value);
+ }
+
+ public function test_3700()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerSession();
+ $this->assertInstanceOf('XoopsSessionHandler', $value);
+ }
+
+ public function test_3800()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerTplfile();
+ $this->assertInstanceOf('XoopsTplfileHandler', $value);
+ }
+
+ public function test_3900()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerTplset();
+ $this->assertInstanceOf('XoopsTplsetHandler', $value);
+ }
+
+ public function test_4000()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandlerUser();
+ $this->assertInstanceOf('XoopsUserHandler', $value);
+ }
+
+ public function test_4100()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getHandler('user');
+ $this->assertInstanceOf('XoopsUserHandler', $value);
+ }
+
+ public function test_4200()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getModuleHandler();
+ $this->assertSame('', $value);
+ }
+
+ public function test_4300()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getModuleForm(null, null);
+ $this->assertSame(false, $value);
+ }
+
+ public function test_4400()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getModuleHelper('page');
+ $this->assertInstanceOf('Page', $value);
+ }
+
+ public function test_4500()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->loadLanguage(null);
+ $this->assertSame(false, $value);
+ }
+
+ public function test_4600()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->loadLocale();
+ $this->assertSame(true, $value);
+ }
+
+ public function test_4700()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->translate(XoopsLocale::ABOUT);
+ $this->assertSame('About', $value);
+ }
+
+ public function test_4800()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getActiveModules();
+ $this->assertTrue(is_array($value) AND count($value)>0);
+ }
+
+ public function test_4900()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->setActiveModules();
+ $this->assertTrue(is_array($value) AND count($value)>0);
+ }
+
+ public function test_5000()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->isActiveModule('page');
+ $this->assertSame(true, $value);
+ }
+
+ public function test_5100()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getModuleByDirname('page');
+ $this->assertinstanceOf('XoopsModule', $value);
+ $this->assertSame('Page', $value->name());
+ }
+
+ public function test_5200()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getModuleById(1);
+ $this->assertinstanceOf('XoopsModule', $value);
+ }
+
+ public function test_5300()
+ {
+ $instance=Xoops::getInstance();
+
+ ob_start();
+ $instance->simpleHeader();
+ $value = ob_get_contents();
+ ob_end_clean();
+ $this->assertTrue(is_string($value));
+ }
+
+ public function test_5400()
+ {
+ $instance=Xoops::getInstance();
+
+ //$instance->simpleFooter();
+ //$this->assertTrue(is_string($value));
+ $this->assertTrue(false);
+ }
+
+ public function test_5500()
+ {
+ $instance=Xoops::getInstance();
+
+ //$value = $instance->alert('test');
+ //$this->assertTrue(is_string($value));
+ $this->assertTrue(false);
+ }
+
+ public function test_5600()
+ {
+ $instance=Xoops::getInstance();
+
+ ob_start();
+ $instance->error('test');
+ $value = ob_get_contents();
+ ob_end_clean();
+ $this->assertTrue(is_string($value));
+ }
+
+ public function test_5700()
+ {
+ $instance=Xoops::getInstance();
+
+ ob_start();
+ $instance->result('test');
+ $value = ob_get_contents();
+ ob_end_clean();
+ $this->assertTrue(is_string($value));
+ }
+
+ public function test_5800()
+ {
+ $instance=Xoops::getInstance();
+
+ defined('NWLINE') OR define('NWLINE', "\n");
+ //$instance->confirm(array(),array(),'msg');
+ //$this->assertTrue(true);
+ $this->assertTrue(false);
+ }
+
+ public function test_5900()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getUserTimestamp(time());
+ $this->assertTrue(is_int($value));
+ }
+
+ public function test_6000()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->userTimeToServerTime(time());
+ $this->assertTrue(is_int($value));
+ }
+
+ public function test_6100()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->makePass();
+ $this->assertTrue(is_string($value));
+ }
+
+ public function test_6200()
+ {
+ $instance=Xoops::getInstance();
+
+ $email = 'te...@te...';
+ $value = $instance->checkEmail($email);
+ $this->assertSame($email, $value);
+ }
+
+ public function test_6300()
+ {
+ $instance=Xoops::getInstance();
+
+ $url = 'http://localhost/xoops';
+ $value = $instance->formatURL($url);
+ $this->assertSame($url, $value);
+
+ $url = 'https://localhost/xoops';
+ $value = $instance->formatURL($url);
+ $this->assertSame($url, $value);
+
+ $url = 'ftp://localhost/xoops';
+ $value = $instance->formatURL($url);
+ $this->assertSame($url, $value);
+
+ $url = 'ftps://localhost/xoops';
+ $value = $instance->formatURL($url);
+ $this->assertSame($url, $value);
+
+ $url = 'ed2k://localhost/xoops';
+ $value = $instance->formatURL($url);
+ $this->assertSame($url, $value);
+
+ $url = 'ed2ks://localhost/xoops';
+ $value = $instance->formatURL($url);
+ $this->assertSame($url, $value);
+
+ $url = 'localhost/xoops';
+ $value = $instance->formatURL($url);
+ $this->assertSame('http://'.$url, $value);
+ }
+
+ public function test_6400()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getBanner();
+ $this->assertSame(null, $value);
+ }
+
+ public function test_6500()
+ {
+ $instance=Xoops::getInstance();
+
+ //$value = $instance->redirect();
+ $this->assertTrue(false);
+ }
+
+ public function test_6600()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getEnv('REQUEST_URI');
+ $this->assertTrue(is_string($value));
+ }
+
+ public function test_6700()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getCss();
+ $this->assertTrue(is_string($value));
+ }
+
+ public function test_6800()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getMailer();
+ $this->assertInstanceOf('XoopsMailerLocale', $value);
+ }
+
+ public function test_6900()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getRank();
+ $this->assertTrue(is_array($value));
+ }
+
+ public function test_7000()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getOption('dummy');
+ $this->assertSame('', $value);
+ }
+
+ public function test_7100()
+ {
+ $instance=Xoops::getInstance();
+
+ $instance->setOption('dummy',null);
+ $value = $instance->getOption('dummy');
+ $this->assertSame('', $value);
+
+ $instance->setOption('dummy','dummy');
+ $value = $instance->getOption('dummy');
+ $this->assertSame('dummy', $value);
+ }
+
+ public function test_7200()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getConfig('dummy');
+ $this->assertSame('', $value);
+ }
+
+ public function test_7300()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getConfigs();
+ $this->assertTrue(is_array($value));
+ }
+
+ public function test_7400()
+ {
+ $instance=Xoops::getInstance();
+
+ $instance->addConfigs(array());
+ }
+
+ public function test_7500()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->setConfig('dummy');
+ }
+
+ public function test_7600()
+ {
+ $instance=Xoops::getInstance();
+
+ $instance->appendConfig('dummy', array());
+ }
+
+ public function test_7700()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getModuleConfig('dummy');
+ $this->assertTrue(is_array($value));
+ }
+
+ public function test_7800()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getModuleConfigs();
+ $this->assertTrue(is_array($value));
+ }
+
+ public function test_7900()
+ {
+ $instance=Xoops::getInstance();
+
+ $instance->disableModuleCache();
+ }
+
+ public function test_8000()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getBaseDomain('http::/localhost/tmp');
+ $this->assertSame('', $value);
+ }
+
+ public function test_8100()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->getUrlDomain('http::/localhost/tmp');
+ $this->assertSame('', $value);
+ }
+
+ public function test_8200()
+ {
+ $instance=Xoops::getInstance();
+
+ $value = $instance->templateTouch('default');
+ $this->assertSame(false, $value);
+ }
+ public function test_8300()
+ {
+ $instance=Xoops::getInstance();
+
+ $instance->templateClearModuleCache(1);
+ }
+
+ public function test_8400()
+ {
+ $instance=Xoops::getInstance();
+
+ $instance->deprecated('message');
+ }
+
+ public function test_8500()
+ {
+ $instance=Xoops::getInstance();
+
+ $instance->disableErrorReporting();
+ }
+
}
|
|
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()
|
|
From: <al...@us...> - 2013-06-25 19:47:46
|
Revision: 11783
http://sourceforge.net/p/xoops/svn/11783
Author: alain91
Date: 2013-06-25 19:47:44 +0000 (Tue, 25 Jun 2013)
Log Message:
-----------
Modified Paths:
--------------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib/XoopsTest.php
Added Paths:
-----------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib.xml
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-25 19:24:11 UTC (rev 11782)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib/XoopsTest.php 2013-06-25 19:47:44 UTC (rev 11783)
@@ -1,9 +1,6 @@
<?php
require_once(dirname(__FILE__).'/../init_mini.php');
-require_once XOOPS_ROOT_PATH . '/locale/en_US/en_US.php';
-require_once XOOPS_ROOT_PATH . '/locale/en_US/locale.php';
-
class XoopsTest extends MY_UnitTestCase
{
@@ -19,6 +16,12 @@
$instance2=Xoops::getInstance();
$this->assertSame($instance, $instance2);
+ // First initialization in first test
+ if (!class_exists('Xoops_Locale',false)) {
+ $value = $instance->loadLocale();
+ $this->assertSame(true, $value);
+ }
+
$this->assertSame(array(XOOPS_PATH, XOOPS_URL . 'browse.php'), $instance->paths['XOOPS']);
$this->assertSame(array(XOOPS_ROOT_PATH, XOOPS_URL), $instance->paths['www']);
$this->assertSame(array(XOOPS_VAR_PATH, null), $instance->paths['var']);
@@ -111,15 +114,27 @@
$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';
+
+ $instance->_theme = null;
$value = $instance->theme('default');
- $this->assertSame($theme, $value);
-
+ $this->assertInstanceOf('XoopsTheme', $value);
+
+ $value = $instance->loadLocale('system');
+ $this->assertSame(true, $value);
+
+ $value = $instance->loadLocale('system/themes/default');
+ $this->assertSame(true, $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';
+
+ $instance->_theme = null;
$instance->isAdminSide = true;
$value = $instance->theme();
- $this->assertSame($theme, $value);
+ $this->assertInstanceOf('XoopsTheme', $value);
+
+ $value = $instance->theme('default');
+ $this->assertInstanceOf('XoopsTheme', $value);
}
public function test_800()
@@ -127,7 +142,7 @@
$instance=Xoops::getInstance();
$value = $instance->path('class');
- $this->assertTrue(basename($value));
+ $this->assertEquals('class', basename($value));
$this->assertEquals(XOOPS_ROOT_PATH, dirname($value));
}
@@ -161,11 +176,11 @@
$instance=Xoops::getInstance();
$this->expectError();
- $value = $instance->pathExists('',E_USER_WARNING);
+ $value = $instance->pathExists('', E_USER_WARNING);
$this->assertSame(false, $value);
- $value = $instance->pathExists('class',E_USER_WARNING);
- $this->assertSame(false, $value);
+ $value = $instance->pathExists(XOOPS_ROOT_PATH, E_USER_WARNING);
+ $this->assertEquals(XOOPS_ROOT_PATH, $value);
}
public function test_1200()
@@ -198,10 +213,10 @@
$path = 'path';
$value = $instance->getTplInfo($path);
- $this->assertSame('module', $value['type']);
+ $this->assertSame('admin', $value['type']);
$this->assertSame('system', $value['module']);
$this->assertSame('path', $value['file']);
- $this->assertSame('module:system|path', $value['tpl_name']);
+ $this->assertSame('admin:system|path', $value['tpl_name']);
}
public function test_1600()
@@ -210,6 +225,9 @@
$value = $instance->header();
$this->assertSame(true, $value);
+
+ $value = $instance->header();
+ $this->assertSame(false, $value);
}
public function test_1700()
@@ -417,7 +435,7 @@
$instance=Xoops::getInstance();
$value = $instance->getModuleHandler();
- $this->assertSame('', $value);
+ $this->assertSame(false, $value);
}
public function test_4300()
@@ -724,14 +742,18 @@
{
$instance=Xoops::getInstance();
- $value = $instance->setConfig('dummy');
+ $instance->setConfig('dummy', 1);
+ $value = $instance->getConfig('dummy');
+ $this->assertSame(1, $value);
}
public function test_7600()
{
$instance=Xoops::getInstance();
- $instance->appendConfig('dummy', array());
+ $instance->appendConfig('dummy', array('test'=>1), true);
+ $value = $instance->getConfig('dummy');
+ $this->assertSame(1, $value['test']);
}
public function test_7700()
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib.xml
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib.xml (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib.xml 2013-06-25 19:47:44 UTC (rev 11783)
@@ -0,0 +1,38 @@
+<phpunit
+ colors="false"
+ verbose="false"
+ stopOnError="false"
+ stopOnFailure="false"
+ stopOnIncomplete="false"
+ stopOnSkipped="false"
+ bootstrap="bootstrap.php"
+ >
+
+<testsuites>
+ <testsuite name="My Test Suite">
+ <directory>xoops_lib</directory>
+ </testsuite>
+</testsuites>
+
+<groups>
+ <exclude>
+ <group>slow</group>
+ </exclude>
+</groups>
+
+<filter>
+ <whitelist>
+ <directory suffix=".php">../htdocs/xoops_lib</directory>
+ <exclude>
+ <directory suffix=".php">../htdocs/xoops_lib/HTMLPurifier</directory>
+ <directory suffix=".php">../htdocs/xoops_lib/modules</directory>
+ <directory suffix=".php">../htdocs/xoops_lib/smarty</directory>
+ </exclude>
+ </whitelist>
+</filter>
+
+<logging>
+ <log type="coverage-html" target="xoops_lib-test-report" charset="UTF-8" yui="true" />
+</logging>
+
+</phpunit>
\ No newline at end of file
|
|
From: <al...@us...> - 2013-06-28 19:01:21
|
Revision: 11797
http://sourceforge.net/p/xoops/svn/11797
Author: alain91
Date: 2013-06-28 19:01:17 +0000 (Fri, 28 Jun 2013)
Log Message:
-----------
add tests to improve code coverage
Modified Paths:
--------------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_simpletest.php
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_simpletest.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_simpletest.php 2013-06-28 10:29:48 UTC (rev 11796)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_simpletest.php 2013-06-28 19:01:17 UTC (rev 11797)
@@ -11,7 +11,6 @@
return $this->assertIdentical($arg1, $arg2, $msg);
}
-
function assertEquals($arg1, $arg2)
{
return $this->assertEqual($arg2, $arg1);
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-28 10:29:48 UTC (rev 11796)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib/XoopsTest.php 2013-06-28 19:01:17 UTC (rev 11797)
@@ -153,9 +153,6 @@
$value = $instance->url('http://localhost/tmp/');
$this->assertSame('http://localhost/tmp/', $value);
- $value = $instance->url('http://localhost/tmp');
- $this->assertSame('http://localhost/tmp', $value);
-
$value = $instance->url('tmp');
$this->assertSame(XOOPS_URL.'/tmp', $value);
}
@@ -167,8 +164,24 @@
$value = $instance->buildUrl('http://localhost/tmp/');
$this->assertSame('http://localhost/tmp/', $value);
- $value = $instance->url('.');
- $this->assertSame(XOOPS_URL.'/.', $value);
+ $value = $instance->buildUrl('.');
+ $this->assertSame($_SERVER['REQUEST_URI'], $value);
+
+ $url = 'http://localhost/tmp/test.php?toto=1';
+ $value = $instance->buildUrl($url);
+ $this->assertSame($url, $value);
+
+ $url = 'http://localhost/tmp/test.php?toto=1';
+ $value = $instance->buildUrl($url,array('titi'=>2));
+ $this->assertSame($url.'&titi=2', $value);
+
+ $url = 'http://localhost/tmp/test.php?toto=1';
+ $value = $instance->buildUrl($url,array('titi'=>'space space'));
+ $this->assertSame($url.'&titi=space%20space', $value);
+
+ $url = 'http://localhost/tmp/test.php?toto=1';
+ $value = $instance->buildUrl($url,array('toto'=>2));
+ $this->assertSame('http://localhost/tmp/test.php?toto=2', $value);
}
public function test_1100()
@@ -214,16 +227,26 @@
{
$instance=Xoops::getInstance();
- $save1 = isset($_SERVER['xoopsUserTheme']) ? $_SERVER['xoopsUserTheme'] : null;
+ $save1 = isset($_SESSION['xoopsUserTheme']) ? $_SESSION['xoopsUserTheme'] : null;
$save2 = isset($_POST['xoops_theme_select']) ? $_POST['xoops_theme_select'] : null;
- $_SERVER['xoopsUserTheme'] = null;
+ $_SESSION['xoopsUserTheme'] = null;
$_POST['xoops_theme_select'] = 'default';
$instance->themeSelect();
$value = $instance->getConfig('theme_set');
$this->assertSame($_POST['xoops_theme_select'], $value);
- //$this->assertSame($_SERVER['xoopsUserTheme'], $value);
- $_SERVER['xoopsUserTheme'] = $save1;
+ $this->assertSame($_SESSION['xoopsUserTheme'], $value);
+ $_SESSION['xoopsUserTheme'] = $save1;
$_POST['xoops_theme_select'] = $save2;
+
+ $save1 = isset($_SESSION['xoopsUserTheme']) ? $_SESSION['xoopsUserTheme'] : null;
+ $save2 = isset($_POST['xoops_theme_select']) ? $_POST['xoops_theme_select'] : null;
+ $_SESSION['xoopsUserTheme'] = 'default';
+ $_POST['xoops_theme_select'] = null;
+ $instance->themeSelect();
+ $value = $instance->getConfig('theme_set');
+ $this->assertSame($_SESSION['xoopsUserTheme'], $value);
+ $_SESSION['xoopsUserTheme'] = $save1;
+ $_POST['xoops_theme_select'] = $save2;
}
@@ -237,6 +260,13 @@
$this->assertSame('system', $value['module']);
$this->assertSame('path', $value['file']);
$this->assertSame('admin:system|path', $value['tpl_name']);
+
+ $path = 'db:path';
+ $value = $instance->getTplInfo($path);
+ $this->assertSame('admin', $value['type']);
+ $this->assertSame('system', $value['module']);
+ $this->assertSame('path', $value['file']);
+ $this->assertSame('admin:system|path', $value['tpl_name']);
}
public function test_1600()
@@ -510,6 +540,10 @@
$value = $instance->getActiveModules();
$this->assertTrue(is_array($value) AND count($value)>0);
+
+ $instance->_activeModules = null;
+ $value = $instance->getActiveModules();
+ $this->assertTrue(is_array($value) AND count($value)>0);
}
public function test_4900()
@@ -526,6 +560,9 @@
$value = $instance->isActiveModule('page');
$this->assertSame(true, $value);
+
+ $value = $instance->isActiveModule(null);
+ $this->assertSame(false, $value);
}
public function test_5100()
@@ -535,6 +572,9 @@
$value = $instance->getModuleByDirname('page');
$this->assertinstanceOf('XoopsModule', $value);
$this->assertSame('Page', $value->name());
+
+ $value = $instance->getModuleByDirname('dummy');
+ $this->assertSame(false, $value);
}
public function test_5200()
@@ -542,7 +582,10 @@
$instance=Xoops::getInstance();
$value = $instance->getModuleById(1);
- $this->assertinstanceOf('XoopsModule', $value);
+ $this->assertInstanceOf('XoopsModule', $value);
+
+ $value = $instance->getModuleById(-1);
+ $this->assertSame(false, $value);
}
public function test_5300()
@@ -569,8 +612,29 @@
{
$instance=Xoops::getInstance();
- $value = $instance->alert('');
- $this->assertSame('', $value);
+ $msg = 'alert_info';
+ $value = $instance->alert($msg);
+ $this->assertTrue(is_string($value) AND strlen($value)>0);
+
+ $msg = 'alert_error';
+ $value = $instance->alert($msg, 'error');
+ $this->assertTrue(is_string($value) AND strlen($value)>0);
+
+ $msg = 'alert_success';
+ $value = $instance->alert($msg, 'success');
+ $this->assertTrue(is_string($value) AND strlen($value)>0);
+
+ $msg = 'alert_warning';
+ $value = $instance->alert($msg, 'warning');
+ $this->assertTrue(is_string($value) AND strlen($value)>0);
+
+ $msg = new XoopsModule();
+ $value = $instance->alert($msg);
+ $this->assertTrue(is_string($value) AND strlen($value)>0);
+
+ $msg = array('text_1', 'text_2');
+ $value = $instance->alert($msg);
+ $this->assertTrue(is_string($value) AND strlen($value)>0);
}
public function test_5600()
@@ -636,9 +700,28 @@
{
$instance=Xoops::getInstance();
+ $value = $instance->checkEmail(null);
+ $this->assertSame(false, $value);
+
$email = 'te...@te...';
$value = $instance->checkEmail($email);
$this->assertSame($email, $value);
+
+ $email = 'te...@te...';
+ $value = $instance->checkEmail($email, true);
+ $this->assertSame('test at test dot com', $value);
+
+ $email = 'test\tot...@te...';
+ $value = $instance->checkEmail($email);
+ $this->assertSame(false, $value);
+
+ $email = 'test@test';
+ $value = $instance->checkEmail($email);
+ $this->assertSame(false, $value);
+
+ $email = 'test@test\titi.com';
+ $value = $instance->checkEmail($email);
+ $this->assertSame(false, $value);
}
public function test_6300()
@@ -694,8 +777,15 @@
{
$instance=Xoops::getInstance();
- $value = $instance->getEnv('REQUEST_URI');
- $this->assertTrue(is_string($value));
+ $_SERVER['DUMMY'] = 'dummy';
+ $value = $instance->getEnv('DUMMY');
+ $this->assertSame('dummy', $value);
+ unset($_SERVER['DUMMY']);
+
+ $_ENV['DUMMY'] = 'dummy';
+ $value = $instance->getEnv('DUMMY');
+ $this->assertSame('dummy', $value);
+ unset($_ENV['DUMMY']);
}
public function test_6700()
@@ -704,6 +794,14 @@
$value = $instance->getCss();
$this->assertTrue(is_string($value));
+
+ $_ENV['HTTP_USER_AGENT'] = 'mac';
+ $value = $instance->getCss();
+ $this->assertSame(XOOPS_THEME_URL . '/default/css/style.css', $value);
+
+ $_ENV['HTTP_USER_AGENT'] = 'MSIE 1.2';
+ $value = $instance->getCss();
+ $this->assertSame(XOOPS_THEME_URL . '/default/css/style.css', $value);
}
public function test_6800()
@@ -711,7 +809,7 @@
$instance=Xoops::getInstance();
$value = $instance->getMailer();
- $this->assertInstanceOf('XoopsMailerLocale', $value);
+ $this->assertTrue($value instanceOf XoopsMailerLocale OR $value instanceOf XoopsMailer);
}
public function test_6900()
@@ -720,6 +818,9 @@
$value = $instance->getRank();
$this->assertTrue(is_array($value));
+
+ $value = $instance->getRank(1);
+ $this->assertTrue(is_array($value));
}
public function test_7000()
@@ -763,7 +864,15 @@
{
$instance=Xoops::getInstance();
- $instance->addConfigs(array());
+ $instance->addConfigs(array('dummy' => 1));
+ $value = $instance->getConfigs();
+ $this->assertTrue(is_array($value));
+ $this->assertTrue(isset($value['dummy']) AND $value['dummy'] = 1);
+
+ $instance->addConfigs(array('dummy' => 1), null);
+ $value = $instance->getConfigs();
+ $this->assertTrue(is_array($value));
+ $this->assertTrue(isset($value['dummy']) AND $value['dummy'] = 1);
}
public function test_7500()
@@ -773,6 +882,10 @@
$instance->setConfig('dummy', 1);
$value = $instance->getConfig('dummy');
$this->assertSame(1, $value);
+
+ $instance->setConfig('dummy', 1, null);
+ $value = $instance->getConfig('dummy');
+ $this->assertSame(1, $value);
}
public function test_7600()
@@ -782,13 +895,21 @@
$instance->appendConfig('dummy', array('test'=>1), true);
$value = $instance->getConfig('dummy');
$this->assertSame(1, $value['test']);
+
+ $instance->appendConfig('dummy', array('test'=>1), false);
+ $value = $instance->getConfig('dummy');
+
+ $instance->appendConfig('dummy', array('test'=>1), true, null);
+ $value = $instance->getConfig('dummy');
+ var_dump($value);exit;
+ $this->assertSame(1, $value['test']);
}
public function test_7700()
{
$instance=Xoops::getInstance();
- $value = $instance->getModuleConfig('dummy');
+ $value = $instance->getModuleConfig(uniqid());
$this->assertFalse($value);
}
|
|
From: <al...@us...> - 2013-07-06 19:51:57
|
Revision: 11810
http://sourceforge.net/p/xoops/svn/11810
Author: alain91
Date: 2013-07-06 19:51:53 +0000 (Sat, 06 Jul 2013)
Log Message:
-----------
fix bug with display error message in MY_UnitTestCase
Modified Paths:
--------------
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/xoops_lib/XoopsTest.php
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-07-05 08:11:27 UTC (rev 11809)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/common_simpletest.php 2013-07-06 19:51:53 UTC (rev 11810)
@@ -6,7 +6,11 @@
class MY_UnitTestCase extends UnitTestCase
{
- function assertSame($arg1, $arg2, $msg='')
+ function __construct($label = false) {
+ parent::__construct($label);
+ }
+
+ function assertSame($arg1, $arg2, $msg='%s')
{
return $this->assertIdentical($arg1, $arg2, $msg);
}
@@ -21,9 +25,9 @@
return $this->assertPattern($arg1, $arg2);
}
- function assertInstanceOf($arg1, $arg2, $message='')
+ function assertInstanceOf($arg1, $arg2)
{
- return $this->assertIsA($arg2, $arg1, $message);
+ return $this->assertIsA($arg2, $arg1);
}
function markTestSkipped($message='')
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-07-05 08:11:27 UTC (rev 11809)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/init_mini.php 2013-07-06 19:51:53 UTC (rev 11810)
@@ -73,7 +73,17 @@
require_once XOOPS_ROOT_PATH . DS . 'include' . DS . 'version.php';
require_once XOOPS_ROOT_PATH . DS . 'class' . DS . 'xoopsload.php';
+$xoops = Xoops::getInstance();
+/**
+ * Load Language settings and defines
+ */
+$xoops->loadLocale();
+//For legacy
+$xoops->setConfig('language', XoopsLocale::getLegacyLanguage());
+date_default_timezone_set(XoopsLocale::getTimezone());
+setlocale(LC_ALL, XoopsLocale::getLocale());
+
if (defined('IS_PHPUNIT')) {
require_once dirname(__FILE__) . '/common_phpunit.php';
} else {
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-07-05 08:11:27 UTC (rev 11809)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib/XoopsTest.php 2013-07-06 19:51:53 UTC (rev 11810)
@@ -3,25 +3,25 @@
class XoopsTest extends MY_UnitTestCase
{
-
+
public function SetUp()
{
}
-
+
public function test_100()
{
- $instance=Xoops::getInstance();
+ $instance = Xoops::getInstance();
$this->assertInstanceOf('Xoops', $instance);
-
+
$instance2=Xoops::getInstance();
$this->assertSame($instance, $instance2);
-
+
// First initialization in first test
if (!class_exists('Xoops_Locale',false)) {
$value = $instance->loadLocale();
$this->assertSame(true, $value);
}
-
+
$this->assertSame(array(XOOPS_PATH, XOOPS_URL . 'browse.php'), $instance->paths['XOOPS']);
$this->assertSame(array(XOOPS_ROOT_PATH, XOOPS_URL), $instance->paths['www']);
$this->assertSame(array(XOOPS_VAR_PATH, null), $instance->paths['var']);
@@ -31,7 +31,7 @@
$this->assertSame(array(XOOPS_ROOT_PATH . '/media', XOOPS_URL . '/media'), $instance->paths['media']);
$this->assertSame(array(XOOPS_PATH, XOOPS_URL . 'browse.php'), $instance->paths['XOOPS']);
$this->assertSame(array(XOOPS_PATH, XOOPS_URL . 'browse.php'), $instance->paths['XOOPS']);
-
+
$this->assertTrue(is_null($instance->sess_handler));
$this->assertTrue(is_null($instance->module));
$this->assertTrue(is_array($instance->config));
@@ -39,167 +39,174 @@
$this->assertTrue(is_string($instance->moduleDirname));
$this->assertTrue(is_string($instance->user) OR is_object($instance->user));
$this->assertTrue(is_bool($instance->userIsAdmin));
- $this->assertTrue(is_null($instance->option) OR is_array($instance->option));
+ $this->assertTrue(is_null($instance->option) OR is_array($instance->option));
$this->assertTrue(is_string($instance->tpl_name));
- $this->assertTrue(is_bool($instance->isAdminSide));
+ $this->assertTrue(is_bool($instance->isAdminSide));
}
-
+
public function test_200()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$db = $instance->db();
$this->assertInstanceOf('XoopsDatabase', $db);
-
+
$db1 = $instance->db();
$this->assertSame($db, $db1);
}
-
+
public function test_300()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->preload();
$this->assertInstanceOf('XoopsPreload', $value);
-
+
$value1 = $instance->preload();
$this->assertSame($value, $value1);
}
-
+
public function test_400()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->registry();
$this->assertInstanceOf('Xoops_Registry', $value);
-
+
$value1 = $instance->registry();
$this->assertSame($value, $value1);
}
-
+
public function test_500()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->security();
$this->assertInstanceOf('XoopsSecurity', $value);
-
+
$value1 = $instance->security();
$this->assertSame($value, $value1);
}
-
+
public function test_600()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$tpl = new XoopsTpl();
-
+
$value = $instance->setTpl($tpl);
$this->assertSame($tpl, $value);
-
+
$value1 = $instance->Tpl();
$this->assertSame($value, $value1);
}
-
+
public function test_700()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->theme();
$this->assertInstanceOf('XoopsTheme', $value);
-
+
$theme = new XoopsTheme();
$value = $instance->setTheme($theme);
$this->assertSame($theme, $value);
-
+
$value = $instance->theme();
$this->assertSame($theme, $value);
-
+
$instance->_theme = null;
$value = $instance->theme('default');
$this->assertInstanceOf('XoopsTheme', $value);
-
+
$value = $instance->loadLocale('system');
$this->assertSame(true, $value);
-
+
$value = $instance->loadLocale('system/themes/default');
$this->assertSame(true, $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';
-
- $instance->_theme = null;
+
+ $instance->_theme = null;
$instance->isAdminSide = true;
$value = $instance->theme();
$this->assertInstanceOf('XoopsTheme', $value);
-
+
$value = $instance->theme('default');
$this->assertInstanceOf('XoopsTheme', $value);
}
-
+
public function test_800()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->path('class');
$this->assertEquals('class', basename($value));
$this->assertEquals(XOOPS_ROOT_PATH, dirname($value));
}
-
+
public function test_900()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->url('http://localhost/tmp/');
$this->assertSame('http://localhost/tmp/', $value);
-
+
$value = $instance->url('tmp');
$this->assertSame(XOOPS_URL.'/tmp', $value);
}
-
+
public function test_1000()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->buildUrl('http://localhost/tmp/');
$this->assertSame('http://localhost/tmp/', $value);
-
+
$value = $instance->buildUrl('.');
$this->assertSame($_SERVER['REQUEST_URI'], $value);
-
+
$url = 'http://localhost/tmp/test.php?toto=1';
$value = $instance->buildUrl($url);
$this->assertSame($url, $value);
-
+
$url = 'http://localhost/tmp/test.php?toto=1';
$value = $instance->buildUrl($url,array('titi'=>2));
$this->assertSame($url.'&titi=2', $value);
-
+
$url = 'http://localhost/tmp/test.php?toto=1';
$value = $instance->buildUrl($url,array('titi'=>'space space'));
$this->assertSame($url.'&titi=space%20space', $value);
-
+
$url = 'http://localhost/tmp/test.php?toto=1';
$value = $instance->buildUrl($url,array('toto'=>2));
$this->assertSame('http://localhost/tmp/test.php?toto=2', $value);
}
-
+
public function test_1100()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$this->expectError();
- $value = $instance->pathExists('', E_USER_WARNING);
+ if (defined('IS_PHPUNIT')) {
+ $NoticeEnabledOrig = PHPUnit_Framework_Error_Notice::$enabled;
+ PHPUnit_Framework_Error_Notice::$enabled = false;
+ }
+ $value = $instance->pathExists('', E_USER_NOTICE);
$this->assertSame(false, $value);
-
- $value = $instance->pathExists(XOOPS_ROOT_PATH, E_USER_WARNING);
- $this->assertEquals(XOOPS_ROOT_PATH, $value);
+ if (defined('IS_PHPUNIT')) {
+ PHPUnit_Framework_Error_Notice::$enabled = $NoticeEnabledOrig;
+ }
+
+ $value = $instance->pathExists(XOOPS_ROOT_PATH, E_USER_NOTICE);
+ $this->assertSame(XOOPS_ROOT_PATH, $value);
}
-
+
public function test_1200()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$save = $_SERVER['SERVER_NAME'];
$_SERVER['SERVER_NAME'] = null;
$instance->gzipCompression();
@@ -207,26 +214,49 @@
$value = $instance->getConfig('gzip_compression');
$this->assertSame(0, $value);
}
-
+
public function test_1300()
{
- $instance=Xoops::getInstance();
-
- $server_name = $_SERVER['PATH_TRANSLATED'];
- $script_filename = $_SERVER['SCRIPT_FILENAME'];
+ $instance = Xoops::getInstance();
+
+ $save = $_SERVER;
+
$_SERVER['PATH_TRANSLATED'] = null;
$_SERVER['SCRIPT_FILENAME'] = 'toto';
$instance->pathTranslation();
$this->assertSame($_SERVER['SCRIPT_FILENAME'], $_SERVER['PATH_TRANSLATED']);
- $_SERVER['PATH_TRANSLATED'] = $server_name;
- $_SERVER['SCRIPT_FILENAME'] = $script_filename;
+ $_SERVER['PATH_TRANSLATED'] = 'toto';
+ $_SERVER['SCRIPT_FILENAME'] = null;
+ $instance->pathTranslation();
+ $this->assertSame($_SERVER['SCRIPT_FILENAME'], $_SERVER['PATH_TRANSLATED']);
+
+ $_SERVER['REQUEST_URI'] = null;
+ $_SERVER['QUERY_STRING'] = null;
+ $_SERVER['PHP_SELF'] = 'toto';
+ $instance->pathTranslation();
+ $this->assertSame($_SERVER['REQUEST_URI'], $_SERVER['PHP_SELF']);
+
+ $_SERVER['REQUEST_URI'] = null;
+ $_SERVER['QUERY_STRING'] = null;
+ $_SERVER['PHP_SELF'] = null;
+ $_SERVER['SCRIPT_NAME'] = 'titi';
+ $instance->pathTranslation();
+ $this->assertSame($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME']);
+
+ $_SERVER['REQUEST_URI'] = null;
+ $_SERVER['QUERY_STRING'] = 'query=1';
+ $_SERVER['PHP_SELF'] = 'toto';
+ $instance->pathTranslation();
+ $this->assertSame($_SERVER['REQUEST_URI'], $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']);
+
+ $_SERVER = $save;
}
-
+
public function test_1400()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$save1 = isset($_SESSION['xoopsUserTheme']) ? $_SESSION['xoopsUserTheme'] : null;
$save2 = isset($_POST['xoops_theme_select']) ? $_POST['xoops_theme_select'] : null;
$_SESSION['xoopsUserTheme'] = null;
@@ -237,7 +267,7 @@
$this->assertSame($_SESSION['xoopsUserTheme'], $value);
$_SESSION['xoopsUserTheme'] = $save1;
$_POST['xoops_theme_select'] = $save2;
-
+
$save1 = isset($_SESSION['xoopsUserTheme']) ? $_SESSION['xoopsUserTheme'] : null;
$save2 = isset($_POST['xoops_theme_select']) ? $_POST['xoops_theme_select'] : null;
$_SESSION['xoopsUserTheme'] = 'default';
@@ -249,18 +279,18 @@
$_POST['xoops_theme_select'] = $save2;
}
-
+
public function test_1500()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$path = 'path';
$value = $instance->getTplInfo($path);
$this->assertSame('admin', $value['type']);
$this->assertSame('system', $value['module']);
$this->assertSame('path', $value['file']);
$this->assertSame('admin:system|path', $value['tpl_name']);
-
+
$path = 'db:path';
$value = $instance->getTplInfo($path);
$this->assertSame('admin', $value['type']);
@@ -268,709 +298,788 @@
$this->assertSame('path', $value['file']);
$this->assertSame('admin:system|path', $value['tpl_name']);
}
-
+
public function test_1600()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->header();
$this->assertSame(true, $value);
-
+
$value = $instance->header();
$this->assertSame(false, $value);
}
-
+
public function test_1700()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
//$value = $instance->footer();
$this->markTestSkipped('');
}
-
+
public function test_1800()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->isModule();
$this->assertSame(false, $value);
-
+
$module = new XoopsModule();
$instance->module = $module;
$value = $instance->isModule();
- $this->assertSame(true, $value);
+ $this->assertSame(true, $value);
}
-
+
public function test_1900()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->isUser();
$this->assertSame(false, $value);
}
-
+
public function test_2000()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->isAdmin();
$this->assertSame(false, $value);
}
-
+
public function test_2100()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->request();
$this->assertInstanceOf('Xoops_Request_Http', $value);
}
-
+
public function test_2200()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerBlock();
$this->assertInstanceOf('XoopsBlockHandler', $value);
}
-
+
public function test_2300()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerBlockmodulelink();
$this->assertInstanceOf('XoopsBlockmodulelinkHandler', $value);
}
-
+
public function test_2400()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerCachemodel();
$this->assertInstanceOf('XoopsCachemodelHandler', $value);
}
-
+
public function test_2500()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerConfig();
$this->assertInstanceOf('XoopsConfigHandler', $value);
}
-
+
public function test_2600()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerConfigcategory();
$this->assertInstanceOf('XoopsConfigCategoryHandler', $value);
}
-
+
public function test_2700()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerConfigitem();
$this->assertInstanceOf('XoopsConfigItemHandler', $value);
}
-
+
public function test_2800()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerConfigoption();
$this->assertInstanceOf('XoopsConfigOptionHandler', $value);
}
-
+
public function test_2900()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerGroup();
$this->assertInstanceOf('XoopsGroupHandler', $value);
}
-
+
public function test_3000()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerGroupperm();
$this->assertInstanceOf('XoopsGrouppermHandler', $value);
}
-
+
public function test_3100()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerMember();
$this->assertInstanceOf('XoopsMemberHandler', $value);
}
-
+
public function test_3200()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerMembership();
$this->assertInstanceOf('XoopsMembershipHandler', $value);
}
-
+
public function test_3300()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerModule();
$this->assertInstanceOf('XoopsModuleHandler', $value);
}
-
+
public function test_3400()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerOnline();
$this->assertInstanceOf('XoopsOnlineHandler', $value);
}
-
+
public function test_3500()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerPrivmessage();
$this->assertInstanceOf('XoopsPrivmessageHandler', $value);
}
-
+
public function test_3600()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerRanks();
$this->assertInstanceOf('XoopsRanksHandler', $value);
}
-
+
public function test_3700()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerSession();
$this->assertInstanceOf('XoopsSessionHandler', $value);
}
-
+
public function test_3800()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerTplfile();
$this->assertInstanceOf('XoopsTplfileHandler', $value);
}
-
+
public function test_3900()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerTplset();
$this->assertInstanceOf('XoopsTplsetHandler', $value);
}
-
+
public function test_4000()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandlerUser();
$this->assertInstanceOf('XoopsUserHandler', $value);
}
-
+
public function test_4100()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getHandler('user');
$this->assertInstanceOf('XoopsUserHandler', $value);
+
+ if (defined('IS_PHPUNIT')) {
+ $WarningEnabledOrig = PHPUnit_Framework_Error_Warning::$enabled;
+ PHPUnit_Framework_Error_Warning::$enabled = false;
+ }
+ $this->expectError();
+ $value = $instance->getHandler('dummy', true);
+ $this->assertSame(false, $value);
+ if (defined('IS_PHPUNIT')) {
+ PHPUnit_Framework_Error_Warning::$enabled = $WarningEnabledOrig;
+ }
}
-
+
public function test_4200()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$instance->module = new XoopsModule();
$value = $instance->getModuleHandler('page_content', 'page');
$this->assertTrue(is_object($value));
}
-
+
public function test_4300()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getModuleForm(null, null);
$this->assertSame(false, $value);
}
-
+
public function test_4400()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getModuleHelper('page');
$this->assertInstanceOf('Page', $value);
}
-
+
public function test_4500()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->loadLanguage(null);
$this->assertSame(false, $value);
+
+ $value = $instance->loadLanguage('_errors', null, 'english');
+ $this->assertTrue(!empty($value));
}
-
+
public function test_4600()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->loadLocale();
$this->assertSame(true, $value);
}
-
+
public function test_4700()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->translate(XoopsLocale::ABOUT);
$this->assertSame('About', $value);
}
-
+
public function test_4800()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getActiveModules();
$this->assertTrue(is_array($value) AND count($value)>0);
-
+
$instance->_activeModules = null;
$value = $instance->getActiveModules();
$this->assertTrue(is_array($value) AND count($value)>0);
}
-
+
public function test_4900()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->setActiveModules();
$this->assertTrue(is_array($value) AND count($value)>0);
}
-
+
public function test_5000()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->isActiveModule('page');
$this->assertSame(true, $value);
-
+
$value = $instance->isActiveModule(null);
$this->assertSame(false, $value);
}
-
+
public function test_5100()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getModuleByDirname('page');
$this->assertinstanceOf('XoopsModule', $value);
$this->assertSame('Page', $value->name());
-
+
$value = $instance->getModuleByDirname('dummy');
$this->assertSame(false, $value);
}
-
+
public function test_5200()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getModuleById(1);
$this->assertInstanceOf('XoopsModule', $value);
-
+
$value = $instance->getModuleById(-1);
$this->assertSame(false, $value);
}
-
+
public function test_5300()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
ob_start();
$instance->simpleHeader();
$value = ob_get_contents();
ob_end_clean();
$this->assertTrue(is_string($value));
}
-
+
public function test_5400()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
//$instance->simpleFooter();
//$this->assertTrue(is_string($value));
$this->markTestSkipped('');
}
-
+
public function test_5500()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
+ $value = $instance->alert('');
+ $this->assertSame('', $value);
+
$msg = 'alert_info';
$value = $instance->alert($msg);
$this->assertTrue(is_string($value) AND strlen($value)>0);
+ $msg = 'alert_info';
+ $value = $instance->alert($msg, 'dummy');
+ $this->assertTrue(is_string($value) AND strlen($value)>0);
+
$msg = 'alert_error';
$value = $instance->alert($msg, 'error');
$this->assertTrue(is_string($value) AND strlen($value)>0);
-
+
$msg = 'alert_success';
$value = $instance->alert($msg, 'success');
$this->assertTrue(is_string($value) AND strlen($value)>0);
-
+
$msg = 'alert_warning';
$value = $instance->alert($msg, 'warning');
$this->assertTrue(is_string($value) AND strlen($value)>0);
-
+
$msg = new XoopsModule();
$value = $instance->alert($msg);
$this->assertTrue(is_string($value) AND strlen($value)>0);
-
+
$msg = array('text_1', 'text_2');
$value = $instance->alert($msg);
$this->assertTrue(is_string($value) AND strlen($value)>0);
}
-
+
public function test_5600()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
ob_start();
$instance->error('test');
$value = ob_get_contents();
ob_end_clean();
$this->assertTrue(is_string($value));
}
-
+
public function test_5700()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
ob_start();
$instance->result('test');
$value = ob_get_contents();
ob_end_clean();
$this->assertTrue(is_string($value));
}
-
+
public function test_5800()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
defined('NWLINE') OR define('NWLINE', "\n");
ob_start();
$instance->confirm(array(),array(),'msg');
$value = ob_get_contents();
ob_end_clean();
+ $this->assertTrue(is_string($value) AND strlen($value)>0);
- $this->assertTrue(true);
+ ob_start();
+ $instance->confirm(array('toto'=>1,'tutu'=>2),array(),'msg');
+ $value = ob_get_contents();
+ ob_end_clean();
+ $this->assertTrue(is_string($value) AND strlen($value)>0);
+
+ ob_start();
+ $instance->confirm(array('toto'=>1, 'tutu'=>array('t1'=>11, 't2'=>22)),array(),'msg');
+ $value = ob_get_contents();
+ ob_end_clean();
+ $this->assertTrue(is_string($value) AND strlen($value)>0);
}
-
+
public function test_5900()
{
- $instance=Xoops::getInstance();
+ $instance = Xoops::getInstance();
+
+ $value = $instance->getUserTimestamp(time());
+ $this->assertTrue(is_int($value));
+ $instance->user = new XoopsUser();
+ $instance->user->setVar('timezone_offset',10);
$value = $instance->getUserTimestamp(time());
$this->assertTrue(is_int($value));
}
-
+
public function test_6000()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->userTimeToServerTime(time());
$this->assertTrue(is_int($value));
}
-
+
public function test_6100()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->makePass();
$this->assertTrue(is_string($value));
+ $value = $instance->makePass();
+ $this->assertTrue(is_string($value));
+ $value = $instance->makePass();
+ $this->assertTrue(is_string($value));
+ $value = $instance->makePass();
+ $this->assertTrue(is_string($value));
}
-
+
public function test_6200()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->checkEmail(null);
$this->assertSame(false, $value);
-
+
$email = 'te...@te...';
$value = $instance->checkEmail($email);
$this->assertSame($email, $value);
-
+
$email = 'te...@te...';
$value = $instance->checkEmail($email, true);
$this->assertSame('test at test dot com', $value);
-
+
$email = 'test\tot...@te...';
$value = $instance->checkEmail($email);
$this->assertSame(false, $value);
-
+
$email = 'test@test';
$value = $instance->checkEmail($email);
$this->assertSame(false, $value);
-
+
$email = 'test@test\titi.com';
$value = $instance->checkEmail($email);
$this->assertSame(false, $value);
}
-
+
public function test_6300()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$url = 'http://localhost/xoops';
$value = $instance->formatURL($url);
$this->assertSame($url, $value);
-
+
$url = 'https://localhost/xoops';
$value = $instance->formatURL($url);
$this->assertSame($url, $value);
-
+
$url = 'ftp://localhost/xoops';
$value = $instance->formatURL($url);
$this->assertSame($url, $value);
-
+
$url = 'ftps://localhost/xoops';
$value = $instance->formatURL($url);
$this->assertSame($url, $value);
-
+
$url = 'ed2k://localhost/xoops';
$value = $instance->formatURL($url);
$this->assertSame($url, $value);
-
+
$url = 'ed2ks://localhost/xoops';
$value = $instance->formatURL($url);
$this->assertSame($url, $value);
-
+
$url = 'localhost/xoops';
$value = $instance->formatURL($url);
$this->assertSame('http://'.$url, $value);
}
-
+
public function test_6400()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$value = $instance->getBanner();
$this->assertSame(null, $value);
}
-
+
public function test_6500()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
//$value = $instance->redirect();
$this->markTestSkipped('');
}
-
+
public function test_6600()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
$_SERVER['DUMMY'] = 'dummy';
$value = $instance->getEnv('DUMMY');
$this->assertSame('dummy', $value);
unset($_SERVER['DUMMY']);
-
+
$_ENV['DUMMY'] = 'dummy';
$value = $instance->getEnv('DUMMY');
$this->assertSame('dummy', $value);
unset($_ENV['DUMMY']);
+
+ unset($_ENV['DUMMY'], $_SERVER['DUMMY']);
+ $value = $instance->getEnv('DUMMY');
+ $this->assertSame('', $value);
}
-
+
public function test_6700()
{
- $instance=Xoops::getInstance();
-
+ $instance = Xoops::getInstance();
+
+ $save = $_SERVER['HTTP_USER_AGENT'];
+
$value = $instance->getCss();
$this->assertTrue(is_string($value));
-
- $_ENV['HTTP_USER_AGENT'] = 'mac';
+
+ $_SERVER['HTTP_USER_AGENT'] = 'mac';
$value = $instance->getCss();
$this->assertSame(XOOPS_THEME_URL . '/default/css/style.css', $value);
-
- $_ENV['HTTP_USER_AGENT'] = 'MSIE 1.2';
+
+ $_SERVER['HTTP_USER_AGENT'] = 'MSIE 1.2';
$value = $instance->getCss();
$this->assertSame(XOOPS_THEME_URL . '/default/css/style.css', $value);
+
+ $_SERVER['HTTP_USER_AGENT'] = 'MSIE 1.2';
+ $va...
[truncated message content] |
|
From: <al...@us...> - 2013-09-04 19:06:18
|
Revision: 12005
http://sourceforge.net/p/xoops/svn/12005
Author: alain91
Date: 2013-09-04 19:06:13 +0000 (Wed, 04 Sep 2013)
Log Message:
-----------
test from jenkins server
Modified Paths:
--------------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/phpunit.xml
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib.xml
Added Paths:
-----------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/ant_class.xml
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/ant_kernel.xml
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/ant_xoops_lib.xml
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/ant_class.xml
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/ant_class.xml (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/ant_class.xml 2013-09-04 19:06:13 UTC (rev 12005)
@@ -0,0 +1,14 @@
+<project name="class" default="build" basedir=".">
+ <property name="basedir" value="${project.basedir}" />
+ <target name="clean">
+ </target>
+ <target name="prepare">
+ </target>
+ <target name="phpunit">
+ <exec executable="/usr/local/bin/phpunit">
+ <arg value="--configuration=${basedir}/ant_class.xml" />
+ </exec>
+ </target>
+ <target name="build" depends="clean,prepare,phpunit" />
+</project>
+
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/ant_kernel.xml
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/ant_kernel.xml (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/ant_kernel.xml 2013-09-04 19:06:13 UTC (rev 12005)
@@ -0,0 +1,14 @@
+<project name="kernel" default="build" basedir=".">
+ <property name="basedir" value="${project.basedir}" />
+ <target name="clean">
+ </target>
+ <target name="prepare">
+ </target>
+ <target name="phpunit">
+ <exec executable="/usr/local/bin/phpunit">
+ <arg value="--configuration=${basedir}/ant_kernel.xml" />
+ </exec>
+ </target>
+ <target name="build" depends="clean,prepare,phpunit" />
+</project>
+
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/ant_xoops_lib.xml
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/ant_xoops_lib.xml (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/ant_xoops_lib.xml 2013-09-04 19:06:13 UTC (rev 12005)
@@ -0,0 +1,14 @@
+<project name="xoops_lib" default="build" basedir=".">
+ <property name="basedir" value="${project.basedir}" />
+ <target name="clean">
+ </target>
+ <target name="prepare">
+ </target>
+ <target name="phpunit">
+ <exec executable="/usr/local/bin/phpunit">
+ <arg value="--configuration=${basedir}/ant_xoops_lib.xml" />
+ </exec>
+ </target>
+ <target name="build" depends="clean,prepare,phpunit" />
+</project>
+
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-09-04 18:17:39 UTC (rev 12004)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/phpunit.xml 2013-09-04 19:06:13 UTC (rev 12005)
@@ -1,35 +1,37 @@
-<phpunit
- 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>
- </testsuite>
-</testsuites>
-
-<groups>
- <exclude>
- <group>slow</group>
- </exclude>
-</groups>
-
-<filter>
- <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" />
-</logging>
-
-</phpunit>
\ No newline at end of file
+<phpunit
+ colors="false"
+ verbose="false"
+ stopOnError="false"
+ stopOnFailure="false"
+ stopOnIncomplete="false"
+ stopOnSkipped="false"
+ bootstrap="bootstrap.php"
+ >
+
+<testsuites>
+ <testsuite name="My XOOPS Test Suite">
+ <directory>class</directory>
+ <directory>kernel</directory>
+ <directory>xoops_lib</directory>
+ </testsuite>
+</testsuites>
+
+<groups>
+ <exclude>
+ <group>slow</group>
+ </exclude>
+</groups>
+
+<filter>
+ <whitelist>
+ <directory suffix=".php">class</directory>
+ <directory suffix=".php">kernel</directory>
+ <directory suffix=".php">xoops_lib</directory>
+ </whitelist>
+</filter>
+
+<logging>
+ <log type="coverage-html" target="test-report" charset="UTF-8" yui="true" />
+</logging>
+
+</phpunit>
Modified: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib.xml
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib.xml 2013-09-04 18:17:39 UTC (rev 12004)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/xoops_lib.xml 2013-09-04 19:06:13 UTC (rev 12005)
@@ -1,38 +1,38 @@
-<phpunit
- colors="false"
- verbose="false"
- stopOnError="false"
- stopOnFailure="false"
- stopOnIncomplete="false"
- stopOnSkipped="false"
- bootstrap="bootstrap.php"
- >
-
-<testsuites>
- <testsuite name="My Test Suite">
- <directory>xoops_lib</directory>
- </testsuite>
-</testsuites>
-
-<groups>
- <exclude>
- <group>slow</group>
- </exclude>
-</groups>
-
-<filter>
- <whitelist>
- <directory suffix=".php">../htdocs/xoops_lib</directory>
- <exclude>
- <directory suffix=".php">../htdocs/xoops_lib/HTMLPurifier</directory>
- <directory suffix=".php">../htdocs/xoops_lib/modules</directory>
- <directory suffix=".php">../htdocs/xoops_lib/smarty</directory>
- </exclude>
- </whitelist>
-</filter>
-
-<logging>
- <log type="coverage-html" target="xoops_lib-test-report" charset="UTF-8" yui="true" />
-</logging>
-
-</phpunit>
\ No newline at end of file
+<phpunit
+ colors="false"
+ verbose="false"
+ stopOnError="false"
+ stopOnFailure="false"
+ stopOnIncomplete="false"
+ stopOnSkipped="false"
+ bootstrap="bootstrap.php"
+ >
+
+<testsuites>
+ <testsuite name="My Test Suite">
+ <directory>xoops_lib</directory>
+ </testsuite>
+</testsuites>
+
+<groups>
+ <exclude>
+ <group>slow</group>
+ </exclude>
+</groups>
+
+<filter>
+ <whitelist>
+ <directory suffix=".php">../xoops_lib</directory>
+ <exclude>
+ <directory suffix=".php">../xoops_lib/HTMLPurifier</directory>
+ <directory suffix=".php">../xoops_lib/modules</directory>
+ <directory suffix=".php">../xoops_lib/smarty</directory>
+ </exclude>
+ </whitelist>
+</filter>
+
+<logging>
+ <log type="coverage-html" target="test-report-xoops_lib" charset="UTF-8" yui="true" />
+</logging>
+
+</phpunit>
|
|
From: <al...@us...> - 2013-09-04 19:25:11
|
Revision: 12006
http://sourceforge.net/p/xoops/svn/12006
Author: alain91
Date: 2013-09-04 19:25:07 +0000 (Wed, 04 Sep 2013)
Log Message:
-----------
add files to SVN
Added Paths:
-----------
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class.xml
XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel.xml
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class.xml
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class.xml (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/class.xml 2013-09-04 19:25:07 UTC (rev 12006)
@@ -0,0 +1,36 @@
+<phpunit
+ colors="false"
+ verbose="false"
+ stopOnError="false"
+ stopOnFailure="false"
+ stopOnIncomplete="false"
+ stopOnSkipped="false"
+ bootstrap="bootstrap.php"
+ >
+
+<testsuites>
+ <testsuite name="My Test Suite">
+ <directory>class</directory>
+ </testsuite>
+</testsuites>
+
+<groups>
+ <exclude>
+ <group>slow</group>
+ </exclude>
+</groups>
+
+<filter>
+ <whitelist>
+ <directory suffix=".php">../class</directory>
+ <exclude>
+ <directory suffix=".php">../class/HTMLPurifier</directory>
+ </exclude>
+ </whitelist>
+</filter>
+
+<logging>
+ <log type="coverage-html" target="test-report-class" charset="UTF-8" yui="true" />
+</logging>
+
+</phpunit>
Added: XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel.xml
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel.xml (rev 0)
+++ XoopsCore/branches/2.6.x/2.6.0_alain091/UnitTestXoops/kernel.xml 2013-09-04 19:25:07 UTC (rev 12006)
@@ -0,0 +1,36 @@
+<phpunit
+ colors="false"
+ verbose="false"
+ stopOnError="false"
+ stopOnFailure="false"
+ stopOnIncomplete="false"
+ stopOnSkipped="false"
+ bootstrap="bootstrap.php"
+ >
+
+<testsuites>
+ <testsuite name="My Test Suite">
+ <directory>kernel</directory>
+ </testsuite>
+</testsuites>
+
+<groups>
+ <exclude>
+ <group>slow</group>
+ </exclude>
+</groups>
+
+<filter>
+ <whitelist>
+ <directory suffix=".php">../kernel</directory>
+ <exclude>
+ <directory suffix=".php">../kernel/HTMLPurifier</directory>
+ </exclude>
+ </whitelist>
+</filter>
+
+<logging>
+ <log type="coverage-html" target="test-report-kernel" charset="UTF-8" yui="true" />
+</logging>
+
+</phpunit>
|