Index: trunk/tests/AppTest.php
===================================================================
--- trunk/tests/AppTest.php	(revision 815)
+++ trunk/tests/AppTest.php	(revision 1)
@@ -1,39 +1,21 @@
 <?php
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- *
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/App.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
+ * PHPUnit test case for App
+ * 
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
+ * 
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class AppTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class AppTest extends PHPUnit_TestCase {
 
     var $App;
 
-    static $shared_session;
+    function AppTest($name)
+    {
+        $this->PHPUnit_TestCase($name);
+    }
 
     function setUp()
@@ -41,6 +23,4 @@
         require dirname(__FILE__) . '/_config.inc.php';
         $this->App =& $app;
-        $this->App->cli = false;
-        $_SESSION = AppTest::$shared_session;
     }
 
@@ -48,11 +28,10 @@
     {
         unset($this->App);
-        AppTest::$shared_session = $_SESSION;
     }
 
     function test_getinstance()
     {
-        $thisapp =& App::getInstance();
-        $this->assertTrue($thisapp === $this->App, 'Objects do not match across instantiations.');
+        $thisapp =& App::getinstance();
+        $this->assertTrue(serialize($thisapp) == serialize($this->App), 'Objects do not match across instantiations.');
     }
 
@@ -62,13 +41,10 @@
             'test_config_value' => 1234
         ));
-        $this->assertTrue(1234 === $this->App->getParam('test_config_value'));
+        $this->assertTrue(1234 === $this->App->_params['test_config_value']);
     }
 
     function test_getParam()
     {
-        //$this->App->setParam('test_config_value2', 'okay');
-        $this->App->setParam(array(
-            'test_config_value2' => 'okay'
-        ));
+        $this->App->_params['test_config_value2'] = 'okay';
         $result = $this->App->getParam('test_config_value2');
         $this->assertEquals('okay', $result);
@@ -80,5 +56,7 @@
         $this->App->stop();
         $this->App->start();
+
         $this->assertEquals(ini_get('error_reporting'), E_ALL, 'Error reporting not set to E_ALL.');
+        $this->assertTrue($this->App->db->dbh && is_resource($this->App->db->dbh), 'DB handler not a resource');
         $this->assertTrue(isset($_SESSION), '$_SESSION is not set.');
         $_SESSION['sess_test_value'] = 'okay';
@@ -93,7 +71,5 @@
     function test_dbquery()
     {
-        $db =& DB::getInstance();
-
-        $qid = $db->query("SELECT 2 + 2");
+        $qid = DB::query("SELECT 2 + 2");
         list($result) = mysql_fetch_row($qid);
         $this->assertEquals('4', $result);
@@ -102,8 +78,7 @@
     function test_raisemsg()
     {
-        $app =& App::getInstance();
         $expected = 'My message';
-        $app->raiseMsg($expected, MSG_NOTICE, __FILE__, __LINE__);
-        $msg = current($_SESSION['_app']['testapp']['messages']);
+        App::raiseMsg($expected, MSG_NOTICE, __FILE__, __LINE__);
+        $msg = current($_SESSION[$this->App->app]['messages']);
         $this->assertEquals($expected, $msg['message']);
     }
@@ -111,8 +86,6 @@
     function test_printraisedmessages()
     {
-        $app =& App::getInstance();
         ob_start();
-        $this->test_raisemsg();  //had to add this line for phpunit ver. 3.7
-        $app->printraisedmessages();
+        App::printraisedmessages();
         $result = ob_get_clean();
         $this->assertContains('My message', $result, 'Raised message not found in output.');
@@ -121,7 +94,6 @@
     function test_logmsg()
     {
-        $app =& App::getInstance();
         $file = $this->App->getParam('log_directory') . '/' . $this->App->getParam('log_filename');
-        $app->logMsg('Test log message', LOG_DEBUG, __FILE__, __LINE__);
+        App::logMsg('Test log message', LOG_DEBUG, __FILE__, __LINE__);
         if ($result = file($file)) {
             $result = end($result);
@@ -134,7 +106,6 @@
     function test_ohref()
     {
-        $app =& App::getInstance();
-        $_REQUEST['arg1'] = 'A';
-        $result = $app->ohref('/some/url.php', array('arg1'), true);
+        $_GET['arg1'] = 'A';
+        $result = App::ohref('/some/url.php', array('arg1'), true);
         $this->assertContains(session_name(), $result, 'SSID not found in URL.');
         $this->assertContains('arg1=A', $result, 'Argument not passed through.');
@@ -143,8 +114,6 @@
     function test_printhiddensession()
     {
-        $app =& App::getInstance();
-        $app->setParam(array('session_use_trans_sid' => true));
         ob_start();
-        $app->printhiddensession();
+        App::printhiddensession();
         $result = ob_get_clean();
         $this->assertContains(session_name(), $result);
@@ -153,8 +122,7 @@
 //     function test_dieurl()
 //     {
-//         $app =& App::getInstance();
-//         $app->dieURL('/die/to/this/url.php');
+//         App::dieURL('/die/to/this/url.php');
 //     }
-//
+// 
 //     function test_dieboomerangurl()
 //     {
@@ -163,5 +131,5 @@
 //         $this->assertEquals($expected, $result);
 //     }
-//
+// 
 //     function test_setboomerangurl()
 //     {
@@ -170,5 +138,5 @@
 //         $this->assertEquals($expected, $result);
 //     }
-//
+// 
 //     function test_getboomerangurl()
 //     {
@@ -177,5 +145,5 @@
 //         $this->assertEquals($expected, $result);
 //     }
-//
+// 
 //     function test_deleteboomerangurl()
 //     {
@@ -184,5 +152,5 @@
 //         $this->assertEquals($expected, $result);
 //     }
-//
+// 
 //     function test_validboomerangurl()
 //     {
@@ -191,5 +159,5 @@
 //         $this->assertEquals($expected, $result);
 //     }
-//
+// 
 //     function test_sslon()
 //     {
@@ -198,5 +166,5 @@
 //         $this->assertEquals($expected, $result);
 //     }
-//
+// 
 //     function test_ssloff()
 //     {
@@ -208,7 +176,6 @@
 }
 // Running the test.
-/*
 $suite = new PHPUnit_TestSuite('AppTest');
 $result = PHPUnit::run($suite);
 echo $result->toString();
- */
+?>
Index: trunk/tests/AuthFileTest.php
===================================================================
--- trunk/tests/AuthFileTest.php	(revision 815)
+++ trunk/tests/AuthFileTest.php	(revision 1)
@@ -1,39 +1,21 @@
 <?php
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
+ * PHPUnit test case for Auth_File
  * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
  * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/AuthFile.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-//
-class AuthFileTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class Auth_FileTest extends PHPUnit_TestCase {
 
-    var $AuthFile;
-    
-    static $shared_session;
+    var $Auth_File;
+
+    function Auth_FileTest($name)
+    {
+        $this->PHPUnit_TestCase($name);
+    }
 
     function setUp()
@@ -41,21 +23,18 @@
         require dirname(__FILE__) . '/_config.inc.php';
         require_once '../lib/Auth_File.inc.php';
-        $this->AuthFile = new Auth_File('test_auth');
-        $this->AuthFile->setParam(array('htpasswd_file' => dirname(__FILE__) . '/_test_htpasswd'));
-        $_SESSION = AuthFileTest::$shared_session;
+        $this->Auth_File =& new Auth_File(array('htpasswd_file' => dirname(__FILE__) . '/_test_htpasswd'));
     }
 
     function tearDown()
     {
-        unset($this->AuthFile);
-        AuthFileTest::$shared_session = $_SESSION;
+        unset($this->Auth_File);
     }
 
     function test_authenticate()
     {
-        $true = $this->AuthFile->authenticate('testuser', 'testpass');
+        $true = $this->Auth_File->authenticate('testuser', 'testpass');
         $this->assertTrue($true, 'testuser not authorized with good password.');
 
-        $false = $this->AuthFile->authenticate('testuser', 'wrongpass');
+        $false = $this->Auth_File->authenticate('testuser', 'wrongpass');
         $this->assertFalse($false, 'testuser not blocked with bad password.');
     }
@@ -63,24 +42,24 @@
     function test_login()
     {
-        $result = $this->AuthFile->login('testuser', 'testpass');
+        $result = $this->Auth_File->login('testuser', 'testpass');
         $this->assertTrue($result, 'testuser login failed.');
-        $this->assertTrue($_SESSION['_auth_file']['test_auth']['authenticated'], 'testuser authentication not found in session.');
+        $this->assertTrue($_SESSION['_auth']['authenticated'], 'testuser authentication not found in session.');
     }
 
-    function test_clear()
+    function test_clearauth()
     {
-        $result = $this->AuthFile->login('testuser', 'testpass');
-        $this->AuthFile->clear();
-        $this->assertFalse($_SESSION['_auth_file']['test_auth']['authenticated'], 'testuser authentication not false in session.');
+        $result = $this->Auth_File->login('testuser', 'testpass');
+        $this->Auth_File->clearauth();
+        $this->assertFalse($_SESSION['_auth']['authenticated'], 'testuser authentication not false in session.');
     }
 
     function test_isloggedin()
     {
-        $this->AuthFile->login('testuser', 'testpass');
-        $true = $this->AuthFile->isloggedin();
+        $this->Auth_File->login('testuser', 'testpass');
+        $true = $this->Auth_File->isloggedin();
         $this->assertTrue($true, 'testuser not logged in but should be.');
 
-        $this->AuthFile->clear();
-        $false = $this->AuthFile->isloggedin();
+        $this->Auth_File->clearauth();
+        $false = $this->Auth_File->isloggedin();
         $this->assertFalse($false, 'testuser is logged in but shouldn\'t be.');
     }
@@ -88,26 +67,26 @@
 //     function test_isadmin()
 //     {
-//         $this->AuthFile->login('testuser', 'testpass');
-//         $true = $this->AuthFile->isadmin();
+//         $this->Auth_File->login('testuser', 'testpass');
+//         $true = $this->Auth_File->isadmin();
 //         $this->assertTrue($true);
 //     }
-//
+// 
 //     function test_requireadminlogin()
 //     {
-//         $result = $this->AuthFile->requireadminlogin(PARAM);
+//         $result = $this->Auth_File->requireadminlogin(PARAM);
 //         $expected = EXPECTED_VAL;
 //         $this->assertEquals($expected, $result);
 //     }
-//
+// 
 //     function test__encrypt()
 //     {
-//         $result = $this->AuthFile->_encrypt(PARAM);
+//         $result = $this->Auth_File->_encrypt(PARAM);
 //         $expected = EXPECTED_VAL;
 //         $this->assertEquals($expected, $result);
 //     }
-//
+// 
 //     function test__salt()
 //     {
-//         $result = $this->AuthFile->_salt(PARAM);
+//         $result = $this->Auth_File->_salt(PARAM);
 //         $expected = EXPECTED_VAL;
 //         $this->assertEquals($expected, $result);
@@ -115,2 +94,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('Auth_FileTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/AuthSQLTest.php
===================================================================
--- trunk/tests/AuthSQLTest.php	(revision 815)
+++ trunk/tests/AuthSQLTest.php	(revision 1)
@@ -1,38 +1,21 @@
 <?php
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- *
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/Auth_SQL.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
+ * PHPUnit test case for Auth_SQL
+ * 
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
+ * 
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-class AuthSQLTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class Auth_SQLTest extends PHPUnit_TestCase {
 
     var $Auth_SQL;
 
-    static $shared_session;
+    function Auth_SQLTest($name)
+    {
+        $this->PHPUnit_TestCase($name);
+    }
 
     function setUp()
@@ -40,5 +23,5 @@
         require dirname(__FILE__) . '/_config.inc.php';
         require_once '../lib/Auth_SQL.inc.php';
-        $this->Auth_SQL = new Auth_SQL('testauth');
+        $this->Auth_SQL =& new Auth_SQL('testauth');
         $this->Auth_SQL->setParam(array(
             'db_table'          => 'test_user_tbl',
@@ -46,6 +29,5 @@
             'db_login_table'    => 'test_login_tbl',
             'login_url'         => '/login.php',
-            'blocking'          => true,
-            'encryption_type' => Auth_SQL::ENCRYPT_MD5_HARDENED,
+            'blocking'          => true
         ));
 
@@ -54,6 +36,5 @@
 
         // Insert test data.
-        $db =& DB::getInstance();
-        $db->query("
+        DB::query("
             INSERT INTO test_user_tbl (
                 username,
@@ -61,39 +42,35 @@
                 first_name,
                 last_name,
-                email
+                email,
+                user_type
             ) VALUES (
                 'testuser',
-                '" . $this->Auth_SQL->encryptPassword('testpass') . "',
+                md5('testpass'),
                 'John',
                 'Doe',
-                'root@localhost'
+                'root@localhost',
+                'admin'
             )
         ");
-        $_SESSION = AuthSQLTest::$shared_session;
-
-        // Sessions require client IP addr.
-        $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
+        
     }
 
     function tearDown()
     {
-        $db =& DB::getInstance();
-
         unset($this->Auth_SQL);
-        $db->query("DROP TABLE IF EXISTS test_user_tbl");
-        $db->query("DROP TABLE IF EXISTS test_login_tbl");
-        AuthSQLTest::$shared_session = $_SESSION;
-    }
-
-    function test_set()
-    {
-        $this->Auth_SQL->set('testuserkey', 'testuserval');
-        $this->assertEquals('testuserval', $_SESSION['_auth_sql']['testauth']['user_data']['testuserkey']);
-    }
-
-    function test_get()
-    {
-        $_SESSION['_auth_sql']['testauth']['user_data']['testuserkey'] = 'testuserval';
-        $val = $this->Auth_SQL->get('testuserkey');
+        DB::query("DROP TABLE IF EXISTS test_user_tbl");
+        DB::query("DROP TABLE IF EXISTS test_login_tbl");
+    }
+
+    function test_setval()
+    {
+        $this->Auth_SQL->setval('testuserkey', 'testuserval');
+        $this->assertEquals('testuserval', $_SESSION[$this->Auth_SQL->_sess]['user_data']['testuserkey']);
+    }
+
+    function test_getval()
+    {
+        $_SESSION[$this->Auth_SQL->_sess]['user_data']['testuserkey'] = 'testuserval';
+        $val = $this->Auth_SQL->getVal('testuserkey');
         $this->assertEquals('testuserval', $val);
     }
@@ -104,18 +81,15 @@
             'login_url'         => 'testloginurl.php'
         ));
-        $this->assertEquals('testloginurl.php', $this->Auth_SQL->getParam('login_url'));
+        $this->assertEquals('testloginurl.php', $this->Auth_SQL->_params['login_url']);
     }
 
     function test_getparam()
     {
-        //$this->Auth_SQL->_params['login_url'] = 'testloginurl.php';
-        $this->Auth_SQL->setParam(array(
-            'login_url'         => 'testloginurl.php'
-        ));
+        $this->Auth_SQL->_params['login_url'] = 'testloginurl.php';
         $param = $this->Auth_SQL->getParam('login_url');
         $this->assertEquals('testloginurl.php', $param);
     }
 
-    function test_clear()
+    function test_clearauth()
     {
         $login = $this->Auth_SQL->login('testuser', 'testpass');
@@ -123,5 +97,5 @@
         $before_logged_in = $this->Auth_SQL->isloggedin();
         $this->assertTrue($before_logged_in, 'User is not logged in, but should be.');
-        $this->Auth_SQL->clear();
+        $this->Auth_SQL->clearauth();
         $after_logged_in = $this->Auth_SQL->isloggedin();
         $this->assertFalse($after_logged_in, 'User is still logged in but should not be.');
@@ -131,9 +105,6 @@
     {
         $true = $this->Auth_SQL->authenticate('testuser', 'testpass');
-        $this->assertInternalType('array', $true, 'User login failed, but should have succeeded.');
-
-        // Testing wrong password.
+        $this->assertTrue($true, 'User login failed, but should have succeeded.');
         $false = $this->Auth_SQL->authenticate('testuser', 'wrongpass');
-
         $this->assertfalse($false, 'User login succeeded, but should have failed.');
     }
@@ -145,14 +116,13 @@
         $before_logged_in = $this->Auth_SQL->isloggedin();
         $this->assertTrue($before_logged_in, '2. User is not logged in, but should be.');
-        $this->Auth_SQL->clear();
+        $this->Auth_SQL->clearauth();
         $after_logged_in = $this->Auth_SQL->isloggedin();
         $this->assertFalse($after_logged_in, '3. User is still logged in but should not be.');
 
-        // Testing wrong password.
         $login2 = $this->Auth_SQL->login('testuser', 'wrongpass');
         $this->assertFalse($login2, '4. User login succeeded, but should have failed.');
         $before_logged_in2 = $this->Auth_SQL->isloggedin();
         $this->assertFalse($before_logged_in2, '5. User is logged in, but should not be.');
-        $this->Auth_SQL->clear();
+        $this->Auth_SQL->clearauth();
         $after_logged_in2 = $this->Auth_SQL->isloggedin();
         $this->assertFalse($after_logged_in2, '6. Wrong user is still logged in but should not be.');
@@ -166,9 +136,7 @@
     function test_blockaccount()
     {
-        $db =& DB::getInstance();
-
         $this->Auth_SQL->login('testuser', 'testpass');
         $this->Auth_SQL->blockaccount(null, 'blocktestuser');
-        $qid = $db->query("
+        $qid = DB::query("
             SELECT blocked_reason
             FROM test_user_tbl
@@ -180,12 +148,10 @@
     function test_unblockaccount()
     {
-        $db =& DB::getInstance();
-
-        $db->query("
+        DB::query("
             UPDATE test_user_tbl SET blocked_reason = 'blocktestuser'
         ");
         $this->Auth_SQL->unblockaccount();
 
-        $qid = $db->query("
+        $qid = DB::query("
             SELECT blocked_reason
             FROM test_user_tbl
@@ -209,55 +175,23 @@
     function test_generatepassword()
     {
-        $result = $this->Auth_SQL->generatepassword(10);
-        $this->assertEquals(14, strlen($result));
+        $result = $this->Auth_SQL->generatepassword('xCVcvd');
+        $this->assertRegExp('/[bcdfghjklmnprstvwxzBCDFGHJKLMNPRSTVWXZaeiouyAEIOUY0123456789][bcdfghjklmnprstvwxzBCDFGHJKLMNPRSTVWXZ][aeiouyAEIOUY][bcdfghjklmnprstvwxz][aeiouy][0123456789]/', $result, 'Generated password does not match intended pattern');
     }
 
     function test_encryptpassword()
     {
-        $result = $this->Auth_SQL->encryptpassword('123', null, Auth_SQL::ENCRYPT_MD5);
+        $result = $this->Auth_SQL->encryptpassword('123');
         $this->assertEquals('202cb962ac59075b964b07152d234b70', $result);
-        $this->assertTrue($this->Auth_SQL->verifyPassword('123', $result, Auth_SQL::ENCRYPT_MD5));
-
-        $result = $this->Auth_SQL->encryptpassword('123', null, Auth_SQL::ENCRYPT_MD5_HARDENED);
-        $this->assertEquals('1f0f8d357a96eb97f24371ebf53dcaf6', $result);
-        $this->assertTrue($this->Auth_SQL->verifyPassword('123', $result, Auth_SQL::ENCRYPT_MD5_HARDENED));
-
-        $result = $this->Auth_SQL->encryptpassword('123', null, Auth_SQL::ENCRYPT_SHA1);
-        $this->assertEquals('40bd001563085fc35165329ea1ff5c5ecbdbbeef', $result);
-        $this->assertTrue($this->Auth_SQL->verifyPassword('123', $result, Auth_SQL::ENCRYPT_SHA1));
-
-        $result = $this->Auth_SQL->encryptpassword('123', null, Auth_SQL::ENCRYPT_SHA1_HARDENED);
-        $this->assertEquals('1d086fcae3dd941e0f1371148502d03e96ab536f', $result);
-        $this->assertTrue($this->Auth_SQL->verifyPassword('123', $result, Auth_SQL::ENCRYPT_SHA1_HARDENED));
-
-        $result = $this->Auth_SQL->encryptpassword('123', null, Auth_SQL::ENCRYPT_PLAINTEXT);
-        $this->assertEquals('123', $result);
-        $this->assertTrue($this->Auth_SQL->verifyPassword('123', $result, Auth_SQL::ENCRYPT_PLAINTEXT));
-
-        $result = $this->Auth_SQL->encryptpassword('123', 'saltstring', Auth_SQL::ENCRYPT_CRYPT);
-        $this->assertTrue($this->Auth_SQL->verifyPassword('123', $result, Auth_SQL::ENCRYPT_CRYPT));
-
-        if (function_exists('password_hash')) {
-            // Only available in PHP >= 5.5
-            $result = $this->Auth_SQL->encryptpassword('123', 'saltstring', Auth_SQL::ENCRYPT_PASSWORD_BCRYPT);
-            $this->assertTrue($this->Auth_SQL->verifyPassword('123', $result, Auth_SQL::ENCRYPT_PASSWORD_BCRYPT));
-
-            $result = $this->Auth_SQL->encryptpassword('123', 'saltstring', Auth_SQL::ENCRYPT_PASSWORD_DEFAULT);
-            $this->assertTrue($this->Auth_SQL->verifyPassword('123', $result, Auth_SQL::ENCRYPT_PASSWORD_DEFAULT));
-        }
     }
 
     function test_setpassword()
     {
-        $db =& DB::getInstance();
-
-        $this->Auth_SQL->setParam(array('hash_type' => Auth_SQL::ENCRYPT_SHA1_HARDENED));
         $this->Auth_SQL->setpassword(null, '123');
-        $qid = $db->query("
+        $qid = DB::query("
             SELECT userpass
             FROM test_user_tbl
         ");
         list($pass) = mysql_fetch_row($qid);
-        $this->assertEquals('1d086fcae3dd941e0f1371148502d03e96ab536f', $pass);
+        $this->assertEquals('202cb962ac59075b964b07152d234b70', $pass);
     }
 
@@ -265,6 +199,5 @@
     {
         $result = $this->Auth_SQL->resetpassword(1, 'Because this is a test.');
-        $this->assertInternalType('array', $result);
-
+        $this->assertType('array', $result);
     }
 
@@ -275,5 +208,5 @@
 //         $this->assertEquals($expected, $result);
 //     }
-//
+// 
 //     function test_requireaccessclearance()
 //     {
@@ -284,3 +217,7 @@
 
 }
-
+// Running the test.
+$suite = new PHPUnit_TestSuite('Auth_SQLTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/Auth_FileTest.php
===================================================================
--- trunk/tests/Auth_FileTest.php	(revision 815)
+++ 	(revision )
@@ -1,121 +1,0 @@
-<?php
-/**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- *
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/Auth_File.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
- * Created with PHPUnit_Skeleton on 2005-08-09
- */
-require_once 'PHPUnit.php';
-class Auth_FileTest extends PHPUnit_TestCase {
-
-    var $Auth_File;
-
-    function Auth_FileTest($name)
-    {
-        $this->PHPUnit_TestCase($name);
-    }
-
-    function setUp()
-    {
-        require dirname(__FILE__) . '/_config.inc.php';
-        require_once '../lib/Auth_File.inc.php';
-        $this->Auth_File =& new Auth_File('test_auth');
-        $this->Auth_File->setParam(array('htpasswd_file' => dirname(__FILE__) . '/_test_htpasswd'));
-    }
-
-    function tearDown()
-    {
-        unset($this->Auth_File);
-    }
-
-    function test_authenticate()
-    {
-        $true = $this->Auth_File->authenticate('testuser', 'testpass');
-        $this->assertTrue($true, 'testuser not authorized with good password.');
-
-        $false = $this->Auth_File->authenticate('testuser', 'wrongpass');
-        $this->assertFalse($false, 'testuser not blocked with bad password.');
-    }
-
-    function test_login()
-    {
-        $result = $this->Auth_File->login('testuser', 'testpass');
-        $this->assertTrue($result, 'testuser login failed.');
-        $this->assertTrue($_SESSION['_auth_file'][$this->Auth_File->_ns]['authenticated'], 'testuser authentication not found in session.');
-    }
-
-    function test_clear()
-    {
-        $result = $this->Auth_File->login('testuser', 'testpass');
-        $this->Auth_File->clear();
-        $this->assertFalse($_SESSION['_auth_file'][$this->Auth_File->_ns]['authenticated'], 'testuser authentication not false in session.');
-    }
-
-    function test_isloggedin()
-    {
-        $this->Auth_File->login('testuser', 'testpass');
-        $true = $this->Auth_File->isloggedin();
-        $this->assertTrue($true, 'testuser not logged in but should be.');
-
-        $this->Auth_File->clear();
-        $false = $this->Auth_File->isloggedin();
-        $this->assertFalse($false, 'testuser is logged in but shouldn\'t be.');
-    }
-
-//     function test_isadmin()
-//     {
-//         $this->Auth_File->login('testuser', 'testpass');
-//         $true = $this->Auth_File->isadmin();
-//         $this->assertTrue($true);
-//     }
-//
-//     function test_requireadminlogin()
-//     {
-//         $result = $this->Auth_File->requireadminlogin(PARAM);
-//         $expected = EXPECTED_VAL;
-//         $this->assertEquals($expected, $result);
-//     }
-//
-//     function test__encrypt()
-//     {
-//         $result = $this->Auth_File->_encrypt(PARAM);
-//         $expected = EXPECTED_VAL;
-//         $this->assertEquals($expected, $result);
-//     }
-//
-//     function test__salt()
-//     {
-//         $result = $this->Auth_File->_salt(PARAM);
-//         $expected = EXPECTED_VAL;
-//         $this->assertEquals($expected, $result);
-//     }
-
-}
-// Running the test.
-$suite = new PHPUnit_TestSuite('Auth_FileTest');
-$result = PHPUnit::run($suite);
-echo $result->toString();
Index: trunk/tests/AuthorizeNetTest.php
===================================================================
--- trunk/tests/AuthorizeNetTest.php	(revision 815)
+++ trunk/tests/AuthorizeNetTest.php	(revision 1)
@@ -1,40 +1,22 @@
 <?php
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
+ * PHPUnit test case for AuthorizeNet
  * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
  * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/AuthorizeNet.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class AuthorizeNetTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class AuthorizeNetTest extends PHPUnit_TestCase {
 
     var $AuthorizeNet;
-    
-    static $shared_session;
-    
+
+    function AuthorizeNetTest($name)
+    {
+        $this->PHPUnit_TestCase($name);
+    }
+
     function setUp()
     {
@@ -42,5 +24,5 @@
         require_once '../lib/AuthorizeNet.inc.php';
 
-        $this->AuthorizeNet = new AuthorizeNet();
+        $this->AuthorizeNet =& new AuthorizeNet();
         $this->AuthorizeNet->setParam(array(
             'x_login' => 'myaccount',
@@ -53,10 +35,9 @@
             'x_exp_date' => '042008',
             'x_invoice_num' => '100',
-            'x_address' => '10 rue levouvÃ©',
+            'x_address' => '10 rue levouv',
             'x_city' => 'somecity',
             'x_state' => 'ca',
             'x_zip' => '75010',
         ));
-        $_SESSION = AuthorizeNetTest::$shared_session;
     }
 
@@ -64,5 +45,4 @@
     {
         unset($this->AuthorizeNet);
-        AuthorizeNetTest::$shared_session = $_SESSION;
     }
 
@@ -70,5 +50,5 @@
     {
         $this->AuthorizeNet->setparam(array('x_Login' => 'myaccount2'));
-        $this->assertEquals('myaccount2', $this->AuthorizeNet->getParam('x_Login'));
+        $this->assertEquals('myaccount2', $this->AuthorizeNet->_params['x_Login']);
     }
 
@@ -83,5 +63,5 @@
     {
         $result_code = $this->AuthorizeNet->process();
-
+        
         $this->assertTrue(false != $result_code, 'Processing did not return valid response. Do you have net access?');
         $this->assertEquals('3', $result_code);
@@ -109,5 +89,5 @@
 //         $this->assertEquals($expected, $result);
 //     }
-//
+// 
 //     function test__processresult()
 //     {
@@ -118,2 +98,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('AuthorizeNetTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/CSSTest.php
===================================================================
--- trunk/tests/CSSTest.php	(revision 815)
+++ trunk/tests/CSSTest.php	(revision 1)
@@ -1,38 +1,22 @@
 <?php
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
+ * PHPUnit test case for CSS
  * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
  * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/CSS.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class CSSTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class CSSTest extends PHPUnit_TestCase {
 
     var $CSS;
     var $test_css_file;
+
+    function CSSTest($name)
+    {
+        $this->PHPUnit_TestCase($name);
+    }
 
     function setUp()
@@ -41,5 +25,5 @@
         $this->test_css_file = dirname(__FILE__) . '/../css/codebase.inc.css';
         require_once '../lib/CSS.inc.php';
-        $this->CSS = new CSS();
+        $this->CSS =& new CSS();
         $this->CSS->setFile($this->test_css_file);
     }
@@ -81,2 +65,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('CSSTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/CacheTest.php
===================================================================
--- trunk/tests/CacheTest.php	(revision 815)
+++ 	(revision )
@@ -1,106 +1,0 @@
-<?php
-/// FIXME: Tests not implemented.
-return;
-
-/**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- *
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/Cache.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
- * Created with PHPUnit_Skeleton on 2005-08-09
- */
-
-class CacheTest extends PHPUnit_Framework_TestCase {
-
-    var $Cache;
-
-    function CacheTest($name)
-    {
-        $this->PHPUnit_Framework_TestCase($name);
-    }
-
-    function setUp()
-    {
-        require dirname(__FILE__) . '/_config.inc.php';
-        require_once '../lib/Cache.inc.php';
-        $this->Cache =& new Cache(PARAM);
-    }
-
-    function tearDown()
-    {
-        unset($this->Cache);
-    }
-
-    function test_getinstance()
-    {
-        $result = $this->Cache->getinstance(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_setparam()
-    {
-        $result = $this->Cache->setparam(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_getparam()
-    {
-        $result = $this->Cache->getparam(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_putcache()
-    {
-        $result = $this->Cache->putcache(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_getcache()
-    {
-        $result = $this->Cache->getcache(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_iscached()
-    {
-        $result = $this->Cache->iscached(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_breakcache()
-    {
-        $result = $this->Cache->breakcache(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-}
Index: trunk/tests/DBSessionHandlerTest.php
===================================================================
--- trunk/tests/DBSessionHandlerTest.php	(revision 815)
+++ trunk/tests/DBSessionHandlerTest.php	(revision 1)
@@ -1,37 +1,21 @@
 <?php
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- *
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/DBSessionHandler.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
+ * PHPUnit test case for DBSessionHandler
+ * 
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
+ * 
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class DBSessionHandlerTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class DBSessionHandlerTest extends PHPUnit_TestCase {
 
     var $DBSessionHandler;
+
+    function DBSessionHandlerTest($name)
+    {
+        $this->PHPUnit_TestCase($name);
+    }
 
     function setUp()
@@ -40,7 +24,13 @@
         require_once '../lib/DBSessionHandler.inc.php';
         session_write_close();
-        $this->DBSessionHandler = new DBSessionHandler($app->db, array(
-            'db_table' => 'session_tbl',
-            'create_table' => true,
+        $this->DBSessionHandler = new DBSessionHandler($app->db);
+        $this->DBSessionHandler = new DBSessionHandler(null, array(
+            'db_server' => $app->getParam('db_server'),
+            'db_name' => $app->getParam('db_name'),
+            'db_user' => $app->getParam('db_user'),
+            'db_pass' => $app->getParam('db_pass'),
+            'db_always_debug' => $app->getParam('db_always_debug'),
+            'db_debug' => $app->getParam('db_debug'),
+            'db_die_on_failure' => $app->getParam('db_die_on_failure'),
         ));
     }
@@ -68,7 +58,4 @@
     function test_DBsessionwrite()
     {
-        if (!isset($_SESSION)) {
-            $_SESSION = array();
-        }
         $this->DBSessionHandler->DBsessionwrite(session_id(), serialize($_SESSION));
     }
@@ -85,2 +72,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('DBSessionHandlerTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/EmailTest.php
===================================================================
--- trunk/tests/EmailTest.php	(revision 815)
+++ 	(revision )
@@ -1,135 +1,0 @@
-<?php
-
-/**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- *
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/Email.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
- * Created with PHPUnit_Skeleton on 2005-12-01
- */
-
-class EmailTest extends PHPUnit_Framework_TestCase {
-
-    var $Email;
-
-    function setUp()
-    {
-        require dirname(__FILE__) . '/_config.inc.php';
-        require_once '../lib/Email.inc.php';
-        $this->Email = new Email();
-    }
-
-    function tearDown()
-    {
-        unset($this->Email);
-    }
-
-//     function testsetparam()
-//     {
-//         $result   = $this->Email->setparam(PARAM);
-//         $expected = EXPECTED_VAL;
-//         $this->assertEquals($expected, $result);
-//     }
-//
-//     function testgetparam()
-//     {
-//         $result   = $this->Email->getparam(PARAM);
-//         $expected = EXPECTED_VAL;
-//         $this->assertEquals($expected, $result);
-//     }
-//
-//     function testsettemplate()
-//     {
-//         $result   = $this->Email->settemplate(PARAM);
-//         $expected = EXPECTED_VAL;
-//         $this->assertEquals($expected, $result);
-//     }
-//
-//     function testsetstring()
-//     {
-//         $result   = $this->Email->setstring(PARAM);
-//         $expected = EXPECTED_VAL;
-//         $this->assertEquals($expected, $result);
-//     }
-//
-//     function testreplace()
-//     {
-//         $result   = $this->Email->replace(PARAM);
-//         $expected = EXPECTED_VAL;
-//         $this->assertEquals($expected, $result);
-//     }
-//
-    function testsend()
-    {
-
-        $this->Email = new Email(array(
-            'to' => 'Rob Recipient <to@example.com>',
-            'from' => 'Sam Sender <from@example.com>',
-            'subject' => 'EmailTest',
-            'headers' => array(
-                'CC' => 'This header removed in REDIRECT sandbox mode <remove-me@example.com>',
-                'X-Hello' => 'Hi there',
-            ),
-            'sandbox_mode' => Email::SANDBOX_MODE_REDIRECT,
-            'sandbox_to_addr' => 'quinn@strangecode.com',
-        ));
-        $this->Email->setString('This is a {TEST}');
-        $this->Email->replace(array(
-            'test' => 'â you guessed it â a test! Sent from ' . __FILE__
-        ));
-        $result   = $this->Email->send();
-        $expected = true;
-        $this->assertEquals($expected, $result);
-    }
-
-    function testvalidemail()
-    {
-        $testpool = file('_email_test_addresses.txt');
-
-        $gc = 0;
-        $bc = 0;
-        $good = array();
-        $bad = array();
-        if (is_array($testpool) && !empty($testpool)) {
-            foreach ($testpool as $a) {
-                if ($this->Email->validEmail($a)) {
-                    $good[] = trim($a);
-                    $gc++;
-                } else {
-                    $bad[] = trim($a);
-                    $bc++;
-                }
-            }
-        }
-        $this->assertEquals(45, $gc, 'Unexpected number of valid emails found.');
-        $this->assertEquals(45, $bc, 'Unexpected number of invalid emails found.');
-        // echo "Good addresses: $gc\n";
-        // echo "Bad addresses: $bc\n";
-        // echo join("\n", $bad);
-        // echo "\n";
-    }
-
-}
Index: trunk/tests/FormValidatorTest.php
===================================================================
--- trunk/tests/FormValidatorTest.php	(revision 815)
+++ trunk/tests/FormValidatorTest.php	(revision 1)
@@ -1,37 +1,21 @@
 <?php
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- *
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/FormValidator.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
+ * PHPUnit test case for FormValidator
+ * 
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
+ * 
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class FormValidatorTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class FormValidatorTest extends PHPUnit_TestCase {
 
     var $FormValidator;
+
+    function FormValidatorTest($name)
+    {
+        $this->PHPUnit_TestCase($name);
+    }
 
     function setUp()
@@ -39,5 +23,5 @@
         require dirname(__FILE__) . '/_config.inc.php';
         require_once '../lib/FormValidator.inc.php';
-        $this->FormValidator = new FormValidator();
+        $this->FormValidator =& new FormValidator(PARAM);
     }
 
@@ -49,13 +33,10 @@
     function test_geterrorlist()
     {
-        $this->FormValidator->addError('some_field', _("This is an error."), MSG_ERR, __FILE__, __LINE__);
-        $err_list = $this->FormValidator->geterrorlist();
-        $this->assertTrue($err_list[0]['message'] === _("This is an error."));
+        $this->FormValidator->geterrorlist();
     }
 
     function test_adderror()
     {
-        $this->FormValidator->addError('some_field', _("This is an error."), MSG_ERR, __FILE__, __LINE__);
-        $this->assertTrue($this->FormValidator->errors[0]['message'] === _("This is an error."));
+        $this->FormValidator->addError('name', _("This is an error."), MSG_ERR, __FILE__, __LINE__);
     }
 
@@ -64,12 +45,9 @@
         $result = $this->FormValidator->anyerrors();
         $this->assertFalse($result);
-        $this->FormValidator->addError('some_field', _("This is an error."), MSG_ERR, __FILE__, __LINE__);
-        $result = $this->FormValidator->anyerrors();
-        $this->assertTrue($result);
     }
 
     function test_reseterrorlist()
     {
-        $this->FormValidator->addError('some_field', _("This is an error."), MSG_ERR, __FILE__, __LINE__);
+        $this->FormValidator->addError('name', _("This is an error."), MSG_ERR, __FILE__, __LINE__);
         $this->FormValidator->reseterrorlist();
         $this->assertFalse($this->FormValidator->anyerrors());
@@ -78,5 +56,5 @@
     function test_printerrormessages()
     {
-        $this->FormValidator->addError('some_field', _("This is an error."), MSG_ERR, __FILE__, __LINE__);
+        $this->FormValidator->addError('name', _("This is an error."), MSG_ERR, __FILE__, __LINE__);
         ob_start();
         $this->FormValidator->printerrormessages();
@@ -87,7 +65,7 @@
     function test_err()
     {
-        $this->FormValidator->addError('some_field', _("This is an error."), MSG_ERR, __FILE__, __LINE__);
+        $this->FormValidator->addError('name', _("This is an error."), MSG_ERR, __FILE__, __LINE__);
         ob_start();
-        $this->FormValidator->err('some_field', 'printthis');
+        $this->FormValidator->err('name', 'printthis');
         $result = ob_get_clean();
         $this->assertContains('printthis', $result);
@@ -96,195 +74,81 @@
     function test_notempty()
     {
-        // This should not generate any error.
-        $_REQUEST['some_field'] = 'a non empty string';
-        $this->FormValidator->notEmpty('some_field', _("Error message"));
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This one is an error!
-        $_REQUEST['some_field'] = '';
-        $this->FormValidator->isempty('some_field', _("Error message"));
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $this->FormValidator->isEmpty('name', _("Error message"));
     }
 
     function test_isempty()
     {
-        // This should not generate any error.
-        $_REQUEST['some_field'] = 'a non empty string';
-        $this->FormValidator->isempty('some_field', _("Error message"));
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This one is an error!
-        $_REQUEST['some_field'] = '';
-        $this->FormValidator->isempty('some_field', _("Error message"));
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $result = $this->FormValidator->isempty('name', _("Error message"));
     }
 
     function test_isstring()
     {
-        // This should not generate any error.
-        $_REQUEST['some_field'] = 'this is a string';
-        $this->FormValidator->isstring('some_field', _("Error message"));
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This one is an error!
-        $_REQUEST['some_field'] = 12.3248; // not a string.
-        $this->FormValidator->isstring('some_field', _("Error message"));
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $result = $this->FormValidator->isstring('name', _("Error message"));
     }
 
     function test_isnumber()
     {
-        // This should not generate any error.
-        $_REQUEST['some_field'] = '1234.453';
-        $this->FormValidator->isnumber('some_field', _("Error message"));
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This one is an error!
-        $_REQUEST['some_field'] = 'not a number';
-        $this->FormValidator->isnumber('some_field', _("Error message"));
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $result = $this->FormValidator->isnumber('name', _("Error message"));
     }
 
     function test_isinteger()
     {
-        // This should not generate any error.
-        $_REQUEST['some_field'] = '1234';
-        $this->FormValidator->isinteger('some_field', _("Error message"));
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This one is an error!
-        $_REQUEST['some_field'] = '1234.1';
-        $this->FormValidator->isinteger('some_field', _("Error message"));
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $result = $this->FormValidator->isinteger('name', _("Error message"));
     }
 
     function test_isfloat()
     {
-        // This should not generate any error.
-        $_REQUEST['some_field'] = '123.1234';
-        $this->FormValidator->isfloat('some_field', _("Error message"));
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This one is an error!
-        $_REQUEST['some_field'] = 'some falsity';
-        $this->FormValidator->isfloat('some_field', _("Error message"));
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $result = $this->FormValidator->isfloat('name', _("Error message"));
     }
 
     function test_isarray()
     {
-        // This should not generate any error.
-        $_REQUEST['some_field'] = array('asdf', 123);
-        $this->FormValidator->isarray('some_field', _("Error message"));
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This one is an error!
-        $_REQUEST['some_field'] = 'some falsity';
-        $this->FormValidator->isarray('some_field', _("Error message"));
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $result = $this->FormValidator->isarray('name', _("Error message"));
     }
 
     function test_checkregex()
     {
-        // This should not generate any error.
-        $_REQUEST['some_field'] = '1234abcd';
-        $this->FormValidator->checkregex('some_field', '/\d{4}[a-d]{4}/', true, _("Error message"));
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This should not generate any error.
-        $_REQUEST['some_field'] = 'no digits here';
-        $this->FormValidator->checkregex('some_field', '/\d/', false, _("Error message"));
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This one is an error!
-        $_REQUEST['some_field'] = 'oops, a d1git';
-        $this->FormValidator->checkregex('some_field', '/\d/', false, _("Error message"));
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $result = $this->FormValidator->checkregex('name', '/\w/', true, _("Error message"));
     }
 
     function test_stringlength()
     {
-        // This should not generate any error.
-        $_REQUEST['some_field'] = 'some truth';
-        $this->FormValidator->stringLength('some_field', 0, 255, _("Error message"));
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This one is an error!
-        $_REQUEST['some_field'] = 'some falsity';
-        $this->FormValidator->stringLength('some_field', 0, 4, _("Error message"));
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $this->FormValidator->stringLength('name', 0, 255, _("Error message"));
     }
 
     function test_numericrange()
     {
-        // This should not generate any error.
-        $_REQUEST['some_field'] = '12';
-        $this->FormValidator->numericrange('some_field', 3, 22, _("Error message"));
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This one is an error!
-        $_REQUEST['some_field'] = '12';
-        $this->FormValidator->numericrange('some_field', 300, 2200, _("Error message"));
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $this->FormValidator->numericrange('name', 0, 255, _("Error message"));
     }
 
     function test_validateemail()
     {
-        // This should not generate any error.
-        $_REQUEST['some_field'] = 'Quinn the Kook <quinn@strangecode.com>';
-        $this->FormValidator->validateemail('some_field', _("Error message"));
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This one is an error!
-        $_REQUEST['some_field'] = 'quinn@kook.com.';
-        $this->FormValidator->validateemail('some_field', _("Error message"));
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $this->FormValidator->validateemail('name');
     }
 
     function test_validatephone()
     {
-        // This should not generate any error.
-        $_REQUEST['some_field'] = '+1 (530) 555-1212';
-        $this->FormValidator->validatephone('some_field', _("Error message"));
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This one is an error!
-        $_REQUEST['some_field'] = 'd321/654*9875 ';
-        $this->FormValidator->validatephone('some_field', _("Error message"));
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $this->FormValidator->validatephone('name');
     }
 
     function test_validatestrdate()
     {
-        // This should not generate any error.
-        $_REQUEST['some_field'] = 'next tuesday';
-        $this->FormValidator->validatestrdate('some_field', _("Error message"));
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This one is an error!
-        $_REQUEST['some_field'] = 'in a galaxy far far away';
-        $this->FormValidator->validatestrdate('some_field', _("Error message"));
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $this->FormValidator->validatestrdate('name');
     }
 
     function test_validateccnumber()
     {
-        // This should not generate any error.
-        $_REQUEST['some_field'] = '2323-2005-7766-3554';
-        $this->FormValidator->validateccnumber('some_field', null);
-        $this->assertFalse($this->FormValidator->anyerrors());
-
-        // This one is an error!
-        $_REQUEST['some_field'] = '1234 1234 1234 1234';
-        $this->FormValidator->validateccnumber('some_field', null);
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $this->FormValidator->validateccnumber('name');
     }
 
-    function test_fileuploaded()
+    function test_validatefile()
     {
-        // This one is an error!
-        $this->FormValidator->fileUploaded('this-file-does-not-exist', _("Error message"));
-        $this->assertTrue($this->FormValidator->anyerrors());
+        $this->FormValidator->validatefile('name');
     }
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('FormValidatorTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/GoogleAPITest.php
===================================================================
--- trunk/tests/GoogleAPITest.php	(revision 1)
+++ trunk/tests/GoogleAPITest.php	(revision 1)
@@ -0,0 +1,76 @@
+<?php
+/// FIXME: Tests not implemented.
+return;
+
+/**
+ * PHPUnit test case for GoogleAPI
+ * 
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
+ * 
+ * Created with PHPUnit_Skeleton on 2005-08-09
+ */
+require_once 'PHPUnit.php';
+class GoogleAPITest extends PHPUnit_TestCase {
+
+    var $GoogleAPI;
+
+    function GoogleAPITest($name)
+    {
+        $this->PHPUnit_TestCase($name);
+    }
+
+    function setUp()
+    {
+        require dirname(__FILE__) . '/_config.inc.php';
+        require_once '../lib/GoogleAPI.inc.php';
+        $this->GoogleAPI =& new GoogleAPI(PARAM);
+    }
+
+    function tearDown()
+    {
+        unset($this->GoogleAPI);
+    }
+
+    function test_getcachedpage()
+    {
+        $result = $this->GoogleAPI->getcachedpage(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_getspellingsuggestion()
+    {
+        $result = $this->GoogleAPI->getspellingsuggestion(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_search()
+    {
+        $result = $this->GoogleAPI->search(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test__performapicall()
+    {
+        $result = $this->GoogleAPI->_performapicall(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_getfault()
+    {
+        $result = $this->GoogleAPI->getfault(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+}
+// Running the test.
+$suite = new PHPUnit_TestSuite('GoogleAPITest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/Google_APITest.php
===================================================================
--- trunk/tests/Google_APITest.php	(revision 815)
+++ 	(revision )
@@ -1,92 +1,0 @@
-<?php
-/// FIXME: Tests not implemented.
-return;
-
-/**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/GoogleAPI.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
- * Created with PHPUnit_Skeleton on 2005-08-09
- */
-
-class GoogleAPITest extends PHPUnit_Framework_TestCase {
-
-    var $GoogleAPI;
-
-    function GoogleAPITest($name)
-    {
-        $this->PHPUnit_Framework_TestCase($name);
-    }
-
-    function setUp()
-    {
-        require dirname(__FILE__) . '/_config.inc.php';
-        require_once '../lib/GoogleAPI.inc.php';
-        $this->GoogleAPI =& new GoogleAPI(PARAM);
-    }
-
-    function tearDown()
-    {
-        unset($this->GoogleAPI);
-    }
-
-    function test_getcachedpage()
-    {
-        $result = $this->GoogleAPI->getcachedpage(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_getspellingsuggestion()
-    {
-        $result = $this->GoogleAPI->getspellingsuggestion(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_search()
-    {
-        $result = $this->GoogleAPI->search(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test__performapicall()
-    {
-        $result = $this->GoogleAPI->_performapicall(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_getfault()
-    {
-        $result = $this->GoogleAPI->getfault(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-}
Index: trunk/tests/HierarchyTest.php
===================================================================
--- trunk/tests/HierarchyTest.php	(revision 815)
+++ 	(revision )
@@ -1,176 +1,0 @@
-<?php
-/// FIXME: Tests not implemented.
-return;
-
-/**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/Hierarchy.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
- * Created with PHPUnit_Skeleton on 2005-08-09
- */
-
-class HierarchyTest extends PHPUnit_Framework_TestCase {
-
-    var $Hierarchy;
-
-    function HierarchyTest($name)
-    {
-        $this->PHPUnit_Framework_TestCase($name);
-    }
-
-    function setUp()
-    {
-        require dirname(__FILE__) . '/_config.inc.php';
-        require_once '../lib/Hierarchy.inc.php';
-        $this->Hierarchy =& new Hierarchy(PARAM);
-    }
-
-    function tearDown()
-    {
-        unset($this->Hierarchy);
-    }
-
-    function test_currentnode()
-    {
-        $result = $this->Hierarchy->currentnode(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_tostringid()
-    {
-        $result = $this->Hierarchy->tostringid(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_toarrayid()
-    {
-        $result = $this->Hierarchy->toarrayid(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_insertnode()
-    {
-        $result = $this->Hierarchy->insertnode(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_deletenode()
-    {
-        $result = $this->Hierarchy->deletenode(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_movenode()
-    {
-        $result = $this->Hierarchy->movenode(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_getparents()
-    {
-        $result = $this->Hierarchy->getparents(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_getnode()
-    {
-        $result = $this->Hierarchy->getnode(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_getchildren()
-    {
-        $result = $this->Hierarchy->getchildren(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_getnumberchildren()
-    {
-        $result = $this->Hierarchy->getnumberchildren(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_isleaf()
-    {
-        $result = $this->Hierarchy->isleaf(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_isancestor()
-    {
-        $result = $this->Hierarchy->isancestor(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_getallancestors()
-    {
-        $result = $this->Hierarchy->getallancestors(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_nodeexists()
-    {
-        $result = $this->Hierarchy->nodeexists(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_getnodelist()
-    {
-        $result = $this->Hierarchy->getnodelist(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_rebuildsubnodeqty()
-    {
-        $result = $this->Hierarchy->rebuildsubnodeqty(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-    function test_setsubnodeqtytoparents()
-    {
-        $result = $this->Hierarchy->setsubnodeqtytoparents(PARAM);
-        $expected = EXPECTED_VAL;
-        $this->assertEquals($expected, $result);
-    }
-
-}
Index: trunk/tests/ImageThumbTest.php
===================================================================
--- trunk/tests/ImageThumbTest.php	(revision 815)
+++ trunk/tests/ImageThumbTest.php	(revision 1)
@@ -4,35 +4,14 @@
 
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
+ * PHPUnit test case for ImageThumb
  * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
  * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/ImageThumb.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class ImageThumbTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class ImageThumbTest extends PHPUnit_TestCase {
 
     var $ImageThumb;
@@ -40,5 +19,5 @@
     function ImageThumbTest($name)
     {
-        $this->PHPUnit_Framework_TestCase($name);
+        $this->PHPUnit_TestCase($name);
     }
 
@@ -119,2 +98,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('ImageThumbTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/LockTest.php
===================================================================
--- trunk/tests/LockTest.php	(revision 815)
+++ 	(revision )
@@ -1,212 +1,0 @@
-<?php
-/**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- *
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/Lock.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
- * Created with PHPUnit_Skeleton on 2005-08-09
- */
-
-class LockTest extends PHPUnit_Framework_TestCase {
-
-    var $Lock;
-    var $Auth_SQL;
-
-    function setUp()
-    {
-        require dirname(__FILE__) . '/_config.inc.php';
-        require_once '../lib/Lock.inc.php';
-        require_once '../lib/Auth_SQL.inc.php';
-
-        $this->Auth_SQL = new Auth_SQL('test');
-        $this->Auth_SQL->setParam(array(
-            'db_table'          => 'test_user_tbl',
-            'db_primary_key'    => 'user_id',
-            'db_login_table'    => 'test_login_tbl',
-            'login_url'         => '/login.php',
-            'blocking'          => true
-        ));
-
-        // Use fresh user table.
-        $this->Auth_SQL->initDB(true);
-
-        // Insert test data.
-        $db =& DB::getInstance();
-        $db->query("
-            INSERT INTO test_user_tbl (
-                username,
-                userpass,
-                first_name,
-                last_name,
-                email
-            ) VALUES (
-                'testuser',
-                '" . $this->Auth_SQL->encryptPassword('testpass') . "',
-                'John',
-                'Doe',
-                'john@example.com'
-            )
-        ");
-
-        // Sessions require client IP addr.
-        $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
-
-        $this->Auth_SQL->login('testuser', 'testpass');
-
-        if (!$this->Auth_SQL->isLoggedIn()) {
-            trigger_error("User login failed...tests canceled.", E_USER_ERROR);
-        }
-
-        $this->Lock =& Lock::getInstance($this->Auth_SQL);
-        $this->Lock->setParam(array('db_table' => 'test_lock_tbl'));
-
-        // Use fresh lock table.
-        $this->Lock->initDB(true);
-    }
-
-    function tearDown()
-    {
-        $db =& DB::getInstance();
-
-        unset($this->Lock);
-        unset($this->Auth_SQL);
-        $db->query("DROP TABLE IF EXISTS test_user_tbl");
-        $db->query("DROP TABLE IF EXISTS test_login_tbl");
-        $db->query("DROP TABLE IF EXISTS test_lock_tbl");
-    }
-
-    function test_getinstance()
-    {
-        $result = Lock::getinstance($this->Auth_SQL);
-        $this->assertTrue($result && $result instanceof \Lock);
-    }
-
-    function test_setparam()
-    {
-        $this->Lock->setparam(array('var'=>'val'));
-    }
-
-    function test_getparam()
-    {
-        $this->Lock->getparam('var');
-    }
-
-    function test_select()
-    {
-        $this->Lock->set('test_user_tbl', 'user_id', '1');
-        $result = $this->Lock->select('test_user_tbl', 'user_id', '1');
-        $this->assertTrue($result);
-    }
-
-    function test_islocked()
-    {
-        $this->Lock->select('test_user_tbl', 'user_id', '1');
-
-        $this->Lock->set('test_user_tbl', 'user_id', '1');
-        $result = $this->Lock->islocked();
-        $this->assertTrue($result, 'Lock was not set.');
-
-        $this->Lock->remove();
-        $this->Lock->select('test_user_tbl', 'user_id', '1');
-        $result = $this->Lock->islocked();
-        $this->assertFalse($result, 'Lock was not removed.');
-    }
-
-    function test_ismine()
-    {
-        $this->Lock->set('test_user_tbl', 'user_id', '1');
-        $this->Lock->select('test_user_tbl', 'user_id', '1');
-        $result = $this->Lock->ismine();
-        $this->assertTrue($result);
-    }
-
-    function test_set()
-    {
-        $this->Lock->select('test_user_tbl', 'user_id', '1');
-        $this->Lock->remove();
-        $this->Lock->set('test_user_tbl', 'user_id', '1');
-        $this->Lock->select('test_user_tbl', 'user_id', '1');
-        $result = $this->Lock->islocked();
-        $this->assertTrue($result);
-    }
-
-    function test_remove()
-    {
-        $this->Lock->select('test_user_tbl', 'user_id', '1');
-        $this->Lock->set('test_user_tbl', 'user_id', '1');
-        $this->Lock->remove();
-        $this->Lock->select('test_user_tbl', 'user_id', '1');
-        $result = $this->Lock->islocked();
-        $this->assertFalse($result);
-    }
-
-    function test_removeall()
-    {
-        $this->Lock->select('test_user_tbl', 'user_id', '1');
-        $this->Lock->set('test_user_tbl', 'user_id', '1');
-        $this->Lock->removeall();
-        $this->Lock->select('test_user_tbl', 'user_id', '1');
-        $result = $this->Lock->islocked();
-        $this->assertFalse($result);
-    }
-
-    function test__auto_timeout()
-    {
-        $this->Lock->_auto_timeout();
-    }
-
-    function test_getid()
-    {
-        $this->Lock->select('test_user_tbl', 'user_id', '1');
-        $this->Lock->set('test_user_tbl', 'user_id', '1');
-        $result = $this->Lock->getid();
-        $this->assertTrue('' != $result);
-        $this->assertTrue(is_numeric($result));
-    }
-
-    function test_gettitle()
-    {
-        $this->Lock->select('test_user_tbl', 'user_id', '1');
-        $this->Lock->set('test_user_tbl', 'user_id', '1', 'userlock');
-        $result = $this->Lock->gettitle();
-        $this->assertEquals('userlock', $result);
-    }
-
-    function test_geteditor()
-    {
-        $this->Lock->select('test_user_tbl', 'user_id', '1');
-        $this->Lock->set('test_user_tbl', 'user_id', '1', 'userlock');
-        $result = $this->Lock->geteditor();
-        $this->assertEquals('testuser', $result);
-    }
-
-    function test_getsecondselapsed()
-    {
-        $result = $this->Lock->getsecondselapsed();
-        $this->assertInternalType('integer', $result);
-    }
-
-}
Index: trunk/tests/MCVETest.php
===================================================================
--- trunk/tests/MCVETest.php	(revision 815)
+++ trunk/tests/MCVETest.php	(revision 1)
@@ -4,35 +4,14 @@
 
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
+ * PHPUnit test case for MCVE
  * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
  * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/MCVE.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class MCVETest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class MCVETest extends PHPUnit_TestCase {
 
     var $MCVE;
@@ -40,5 +19,5 @@
     function MCVETest($name)
     {
-        $this->PHPUnit_Framework_TestCase($name);
+        $this->PHPUnit_TestCase($name);
     }
 
@@ -91,2 +70,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('MCVETest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/NavTest.php
===================================================================
--- trunk/tests/NavTest.php	(revision 815)
+++ trunk/tests/NavTest.php	(revision 1)
@@ -4,41 +4,20 @@
 
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
+ * PHPUnit test case for Nav
  * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
  * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/Navigation.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
+require_once 'PHPUnit.php';
+class NavTest extends PHPUnit_TestCase {
 
-class NavigationTest extends PHPUnit_Framework_TestCase {
+    var $Nav;
 
-    var $Navigation;
-
-    function NavigationTest($name)
+    function NavTest($name)
     {
-        $this->PHPUnit_Framework_TestCase($name);
+        $this->PHPUnit_TestCase($name);
     }
 
@@ -46,16 +25,16 @@
     {
         require dirname(__FILE__) . '/_config.inc.php';
-        require_once '../lib/Navigation.inc.php';
-        $this->Navigation =& new Navigation(PARAM);
+        require_once '../lib/Nav.inc.php';
+        $this->Nav =& new Nav(PARAM);
     }
 
     function tearDown()
     {
-        unset($this->Navigation);
+        unset($this->Nav);
     }
 
     function test_addpage()
     {
-        $result = $this->Navigation->addpage(PARAM);
+        $result = $this->Nav->addpage(PARAM);
         $expected = EXPECTED_VAL;
         $this->assertEquals($expected, $result);
@@ -64,5 +43,5 @@
     function test_setfeature()
     {
-        $result = $this->Navigation->setfeature(PARAM);
+        $result = $this->Nav->setfeature(PARAM);
         $expected = EXPECTED_VAL;
         $this->assertEquals($expected, $result);
@@ -71,5 +50,5 @@
     function test_clearpath()
     {
-        $result = $this->Navigation->clearpath(PARAM);
+        $result = $this->Nav->clearpath(PARAM);
         $expected = EXPECTED_VAL;
         $this->assertEquals($expected, $result);
@@ -78,5 +57,5 @@
     function test_getfeature()
     {
-        $result = $this->Navigation->getfeature(PARAM);
+        $result = $this->Nav->getfeature(PARAM);
         $expected = EXPECTED_VAL;
         $this->assertEquals($expected, $result);
@@ -85,5 +64,5 @@
     function test_gettitle()
     {
-        $result = $this->Navigation->gettitle(PARAM);
+        $result = $this->Nav->gettitle(PARAM);
         $expected = EXPECTED_VAL;
         $this->assertEquals($expected, $result);
@@ -92,5 +71,5 @@
     function test_printtitle()
     {
-        $result = $this->Navigation->printtitle(PARAM);
+        $result = $this->Nav->printtitle(PARAM);
         $expected = EXPECTED_VAL;
         $this->assertEquals($expected, $result);
@@ -99,5 +78,5 @@
     function test_getpath()
     {
-        $result = $this->Navigation->getpath(PARAM);
+        $result = $this->Nav->getpath(PARAM);
         $expected = EXPECTED_VAL;
         $this->assertEquals($expected, $result);
@@ -106,5 +85,5 @@
     function test_printpath()
     {
-        $result = $this->Navigation->printpath(PARAM);
+        $result = $this->Nav->printpath(PARAM);
         $expected = EXPECTED_VAL;
         $this->assertEquals($expected, $result);
@@ -113,5 +92,5 @@
     function test_getbreadcrumbs()
     {
-        $result = $this->Navigation->getbreadcrumbs(PARAM);
+        $result = $this->Nav->getbreadcrumbs(PARAM);
         $expected = EXPECTED_VAL;
         $this->assertEquals($expected, $result);
@@ -120,5 +99,5 @@
     function test_printbreadcrumbs()
     {
-        $result = $this->Navigation->printbreadcrumbs(PARAM);
+        $result = $this->Nav->printbreadcrumbs(PARAM);
         $expected = EXPECTED_VAL;
         $this->assertEquals($expected, $result);
@@ -127,5 +106,5 @@
     function test_currentpage()
     {
-        $result = $this->Navigation->currentpage(PARAM);
+        $result = $this->Nav->currentpage(PARAM);
         $expected = EXPECTED_VAL;
         $this->assertEquals($expected, $result);
@@ -133,2 +112,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('NavTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/NodeHeirarchyTest.php
===================================================================
--- trunk/tests/NodeHeirarchyTest.php	(revision 1)
+++ trunk/tests/NodeHeirarchyTest.php	(revision 1)
@@ -0,0 +1,160 @@
+<?php
+/// FIXME: Tests not implemented.
+return;
+
+/**
+ * PHPUnit test case for NodeHeirarchy
+ * 
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
+ * 
+ * Created with PHPUnit_Skeleton on 2005-08-09
+ */
+require_once 'PHPUnit.php';
+class NodeHeirarchyTest extends PHPUnit_TestCase {
+
+    var $NodeHeirarchy;
+
+    function NodeHeirarchyTest($name)
+    {
+        $this->PHPUnit_TestCase($name);
+    }
+
+    function setUp()
+    {
+        require dirname(__FILE__) . '/_config.inc.php';
+        require_once '../lib/NodeHeirarchy.inc.php';
+        $this->NodeHeirarchy =& new NodeHeirarchy(PARAM);
+    }
+
+    function tearDown()
+    {
+        unset($this->NodeHeirarchy);
+    }
+
+    function test_currentnode()
+    {
+        $result = $this->NodeHeirarchy->currentnode(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_tostringid()
+    {
+        $result = $this->NodeHeirarchy->tostringid(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_toarrayid()
+    {
+        $result = $this->NodeHeirarchy->toarrayid(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_insertnode()
+    {
+        $result = $this->NodeHeirarchy->insertnode(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_deletenode()
+    {
+        $result = $this->NodeHeirarchy->deletenode(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_movenode()
+    {
+        $result = $this->NodeHeirarchy->movenode(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_getparents()
+    {
+        $result = $this->NodeHeirarchy->getparents(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_getnode()
+    {
+        $result = $this->NodeHeirarchy->getnode(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_getchildren()
+    {
+        $result = $this->NodeHeirarchy->getchildren(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_getnumberchildren()
+    {
+        $result = $this->NodeHeirarchy->getnumberchildren(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_isleaf()
+    {
+        $result = $this->NodeHeirarchy->isleaf(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_isancestor()
+    {
+        $result = $this->NodeHeirarchy->isancestor(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_getallancestors()
+    {
+        $result = $this->NodeHeirarchy->getallancestors(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_nodeexists()
+    {
+        $result = $this->NodeHeirarchy->nodeexists(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_getnodelist()
+    {
+        $result = $this->NodeHeirarchy->getnodelist(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_rebuildsubnodeqty()
+    {
+        $result = $this->NodeHeirarchy->rebuildsubnodeqty(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_setsubnodeqtytoparents()
+    {
+        $result = $this->NodeHeirarchy->setsubnodeqtytoparents(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+}
+// Running the test.
+$suite = new PHPUnit_TestSuite('NodeHeirarchyTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/PEditTest.php
===================================================================
--- trunk/tests/PEditTest.php	(revision 815)
+++ trunk/tests/PEditTest.php	(revision 1)
@@ -4,35 +4,14 @@
 
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
+ * PHPUnit test case for PEdit
  * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
+ * T\he method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
  * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/PEdit.inc.php
- *
- * T\he method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class PEditTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class PEditTest extends PHPUnit_TestCase {
 
     var $PEdit;
@@ -40,5 +19,5 @@
     function PEditTest($name)
     {
-        $this->PHPUnit_Framework_TestCase($name);
+        $this->PHPUnit_TestCase($name);
     }
 
@@ -154,2 +133,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('PEditTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/PageNumbersTest.php
===================================================================
--- trunk/tests/PageNumbersTest.php	(revision 815)
+++ trunk/tests/PageNumbersTest.php	(revision 1)
@@ -4,35 +4,14 @@
 
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
+ * PHPUnit test case for PageNumbers
  * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
  * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/PageNumbers.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class PageNumbersTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class PageNumbersTest extends PHPUnit_TestCase {
 
     var $PageNumbers;
@@ -40,5 +19,5 @@
     function PageNumbersTest($name)
     {
-        $this->PHPUnit_Framework_TestCase($name);
+        $this->PHPUnit_TestCase($name);
     }
 
@@ -133,2 +112,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('PageNumbersTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/PageSequenceTest.php
===================================================================
--- trunk/tests/PageSequenceTest.php	(revision 815)
+++ trunk/tests/PageSequenceTest.php	(revision 1)
@@ -4,35 +4,14 @@
 
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
+ * PHPUnit test case for PageSequence
  * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
  * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/PageSequence.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class PageSequenceTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class PageSequenceTest extends PHPUnit_TestCase {
 
     var $PageSequence;
@@ -40,5 +19,5 @@
     function PageSequenceTest($name)
     {
-        $this->PHPUnit_Framework_TestCase($name);
+        $this->PHPUnit_TestCase($name);
     }
 
@@ -182,2 +161,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('PageSequenceTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/PayPalTest.php
===================================================================
--- trunk/tests/PayPalTest.php	(revision 815)
+++ trunk/tests/PayPalTest.php	(revision 1)
@@ -1,37 +1,21 @@
 <?php
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
+ * PHPUnit test case for PayPal
  * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
  * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/PayPal.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class PayPalTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class PayPalTest extends PHPUnit_TestCase {
 
     var $PayPal;
+
+    function PayPalTest($name)
+    {
+        $this->PHPUnit_TestCase($name);
+    }
 
     function setUp()
@@ -39,5 +23,5 @@
         require dirname(__FILE__) . '/_config.inc.php';
         require_once '../lib/PayPal.inc.php';
-        $this->PayPal = new PayPal();
+        $this->PayPal =& new PayPal();
 
         // Defaults for purchasing classified postings.
@@ -85,6 +69,5 @@
         ));
         $result = $this->PayPal->getlink('testitem');
-        //$this->assertTrue(preg_match('/customdata/', $result));
-        $this->assertSame(1, preg_match('/customdata/', $result));
+        $this->assertTrue(preg_match('/customdata/', $result));
     }
 
@@ -99,7 +82,5 @@
         $this->PayPal->printbutton('testitem');
         $result = ob_get_clean();
-        //$this->assertTrue(preg_match('/customdata/', $result));
-        $this->assertSame(1, preg_match('/customdata/', $result));
-        
+        $this->assertTrue(preg_match('/customdata/', $result));
     }
 
@@ -120,10 +101,10 @@
 //         $result = $this->PayPal->incomingipnrequest();
 //     }
-//
+// 
 //     function test_processipn()
 //     {
 //         $result = $this->PayPal->processipn();
 //     }
-//
+// 
 //     function test_verifiedipn()
 //     {
@@ -132,2 +113,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('PayPalTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/PrefsTest.php
===================================================================
--- trunk/tests/PrefsTest.php	(revision 815)
+++ trunk/tests/PrefsTest.php	(revision 1)
@@ -4,35 +4,14 @@
 
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- *
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/Prefs.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
+ * PHPUnit test case for Prefs
+ * 
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
+ * 
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class PrefsTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class PrefsTest extends PHPUnit_TestCase {
 
     var $Prefs;
@@ -40,5 +19,5 @@
     function PrefsTest($name)
     {
-        $this->PHPUnit_Framework_TestCase($name);
+        $this->PHPUnit_TestCase($name);
     }
 
@@ -47,7 +26,5 @@
         require dirname(__FILE__) . '/_config.inc.php';
         require_once '../lib/Prefs.inc.php';
-        $prefs = new Prefs('test', array(
-            'storagetype' => 'session',
-        ));
+        $this->Prefs =& new Prefs(PARAM);
     }
 
@@ -71,7 +48,7 @@
     }
 
-    function test_getue()
+    function test_getvalue()
     {
-        $result = $this->Prefs->getue(PARAM);
+        $result = $this->Prefs->getvalue(PARAM);
         $expected = EXPECTED_VAL;
         $this->assertEquals($expected, $result);
@@ -114,2 +91,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('PrefsTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/RecordLockTest.php
===================================================================
--- trunk/tests/RecordLockTest.php	(revision 1)
+++ trunk/tests/RecordLockTest.php	(revision 1)
@@ -0,0 +1,192 @@
+<?php
+/**
+ * PHPUnit test case for RecordLock
+ * 
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
+ * 
+ * Created with PHPUnit_Skeleton on 2005-08-09
+ */
+require_once 'PHPUnit.php';
+class RecordLockTest extends PHPUnit_TestCase {
+
+    var $RecordLock;
+    var $Auth_SQL;
+
+    function RecordLockTest($name)
+    {
+        $this->PHPUnit_TestCase($name);
+    }
+
+    function setUp()
+    {
+        require dirname(__FILE__) . '/_config.inc.php';
+        require_once '../lib/RecordLock.inc.php';
+        require_once '../lib/Auth_SQL.inc.php';
+
+        $this->Auth_SQL =& new Auth_SQL('testauth');
+        $this->Auth_SQL->setParam(array(
+            'db_table'          => 'test_user_tbl',
+            'db_primary_key'    => 'user_id',
+            'db_login_table'    => 'test_login_tbl',
+            'login_url'         => '/login.php',
+            'blocking'          => true
+        ));
+
+        // Use fresh user table.
+        $this->Auth_SQL->initDB(true);
+
+        // Insert test data.
+        DB::query("
+            INSERT INTO test_user_tbl (
+                username,
+                userpass,
+                first_name,
+                last_name,
+                email,
+                user_type
+            ) VALUES (
+                'testuser',
+                md5('testpass'),
+                'John',
+                'Doe',
+                'john@example.com',
+                'admin'
+            )
+        ");
+        $this->Auth_SQL->login('testuser', 'testpass');
+
+        $this->RecordLock =& RecordLock::getInstance($this->Auth_SQL);
+        $this->RecordLock->setParam(array('db_table' => 'test_lock_tbl'));
+
+        // Use fresh lock table.
+        $this->RecordLock->initDB(true);
+    }
+
+    function tearDown()
+    {
+        unset($this->RecordLock);
+        unset($this->Auth_SQL);
+        DB::query("DROP TABLE IF EXISTS test_user_tbl");
+        DB::query("DROP TABLE IF EXISTS test_login_tbl");
+        DB::query("DROP TABLE IF EXISTS test_lock_tbl");
+    }
+
+    function test_getinstance()
+    {
+        $result = RecordLock::getinstance($this->Auth_SQL);
+        $this->assertTrue($result && is_a($result, 'RecordLock'));
+    }
+
+    function test_setparam()
+    {
+        $this->RecordLock->setparam(array('var'=>'val'));
+    }
+
+    function test_getparam()
+    {
+        $this->RecordLock->getparam('var');
+    }
+
+    function test_select()
+    {
+        $this->RecordLock->set('test_user_tbl', 'user_id', '1');
+        $result = $this->RecordLock->select('test_user_tbl', 'user_id', '1');
+        $this->assertTrue($result);
+    }
+
+    function test_islocked()
+    {
+        $this->RecordLock->select('test_user_tbl', 'user_id', '1');
+
+        $this->RecordLock->set('test_user_tbl', 'user_id', '1');
+        $result = $this->RecordLock->islocked();
+        $this->assertTrue($result, 'Lock was not set.');
+
+        $this->RecordLock->remove();
+        $this->RecordLock->select('test_user_tbl', 'user_id', '1');
+        $result = $this->RecordLock->islocked();
+        $this->assertFalse($result, 'Lock was not removed.');
+    }
+
+    function test_ismine()
+    {
+        $this->RecordLock->set('test_user_tbl', 'user_id', '1');
+        $this->RecordLock->select('test_user_tbl', 'user_id', '1');
+        $result = $this->RecordLock->ismine();
+        $this->assertTrue($result);
+    }
+
+    function test_set()
+    {
+        $this->RecordLock->select('test_user_tbl', 'user_id', '1');
+        $this->RecordLock->remove();
+        $this->RecordLock->set('test_user_tbl', 'user_id', '1');
+        $this->RecordLock->select('test_user_tbl', 'user_id', '1');
+        $result = $this->RecordLock->islocked();
+        $this->assertTrue($result);
+    }
+
+    function test_remove()
+    {
+        $this->RecordLock->select('test_user_tbl', 'user_id', '1');
+        $this->RecordLock->set('test_user_tbl', 'user_id', '1');
+        $this->RecordLock->remove();
+        $this->RecordLock->select('test_user_tbl', 'user_id', '1');
+        $result = $this->RecordLock->islocked();
+        $this->assertFalse($result);
+    }
+
+    function test_removeall()
+    {
+        $this->RecordLock->select('test_user_tbl', 'user_id', '1');
+        $this->RecordLock->set('test_user_tbl', 'user_id', '1');
+        $this->RecordLock->removeall();
+        $this->RecordLock->select('test_user_tbl', 'user_id', '1');
+        $result = $this->RecordLock->islocked();
+        $this->assertFalse($result);
+    }
+
+    function test__auto_timeout()
+    {
+        $this->RecordLock->_auto_timeout();
+    }
+
+    function test_getid()
+    {
+        $this->RecordLock->select('test_user_tbl', 'user_id', '1');
+        $this->RecordLock->set('test_user_tbl', 'user_id', '1');
+        $result = $this->RecordLock->getid();
+        $this->assertTrue('' != $result);
+        $this->assertTrue(is_numeric($result));
+    }
+
+    function test_gettitle()
+    {
+        $this->RecordLock->select('test_user_tbl', 'user_id', '1');
+        $this->RecordLock->set('test_user_tbl', 'user_id', '1', 'userlock');
+        $result = $this->RecordLock->gettitle();
+        $this->assertEquals('userlock', $result);
+    }
+
+    function test_geteditor()
+    {
+        $this->RecordLock->select('test_user_tbl', 'user_id', '1');
+        $this->RecordLock->set('test_user_tbl', 'user_id', '1', 'userlock');
+        $result = $this->RecordLock->geteditor();
+        $this->assertEquals('testuser', $result);
+    }
+
+    function test_getsecondselapsed()
+    {
+        $result = $this->RecordLock->getsecondselapsed();
+        $this->assertType('integer', $result);
+    }
+
+}
+// Running the test.
+$suite = new PHPUnit_TestSuite('RecordLockTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/RecordVersionTest.php
===================================================================
--- trunk/tests/RecordVersionTest.php	(revision 1)
+++ trunk/tests/RecordVersionTest.php	(revision 1)
@@ -0,0 +1,174 @@
+<?php
+/**
+ * PHPUnit test case for RecordVersion
+ * 
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
+ * 
+ * Created with PHPUnit_Skeleton on 2005-08-09
+ */
+require_once 'PHPUnit.php';
+class RecordVersionTest extends PHPUnit_TestCase {
+
+    var $RecordVersion;
+    var $Auth_SQL;
+
+    function RecordVersionTest($name)
+    {
+        $this->PHPUnit_TestCase($name);
+    }
+
+    function setUp()
+    {
+        require dirname(__FILE__) . '/_config.inc.php';
+        require_once '../lib/RecordVersion.inc.php';
+
+        require_once '../lib/Auth_SQL.inc.php';
+        $this->Auth_SQL =& new Auth_SQL('testauth');
+        $this->Auth_SQL->setParam(array(
+            'db_table'          => 'test_user_tbl',
+            'db_primary_key'    => 'user_id',
+            'db_login_table'    => 'test_login_tbl',
+            'login_url'         => '/login.php',
+            'blocking'          => true
+        ));
+
+        // Use fresh user table.
+        $this->Auth_SQL->initDB(true);
+        
+        // Insert test data.
+        DB::query("
+            INSERT INTO test_user_tbl (
+                username,
+                userpass,
+                first_name,
+                last_name,
+                email,
+                user_type
+            ) VALUES (
+                'testuser',
+                md5('testpass'),
+                'John',
+                'Doe',
+                'john@example.com',
+                'admin'
+            )
+        ");
+        
+        $this->Auth_SQL->login('testuser', 'testpass');
+        
+        $this->RecordVersion =& RecordVersion::getInstance($this->Auth_SQL);
+        $this->RecordVersion->setParam(array('db_table' => 'test_version_tbl'));
+
+        // Use fresh version table.
+        $this->RecordVersion->initDB(true);
+    }
+
+    function tearDown()
+    {
+        unset($this->RecordVersion);
+        unset($this->Auth_SQL);
+        DB::query("DROP TABLE IF EXISTS test_user_tbl");
+        DB::query("DROP TABLE IF EXISTS test_login_tbl");
+        DB::query("DROP TABLE IF EXISTS test_version_tbl");
+    }
+
+    function test_getinstance()
+    {
+        $result = RecordVersion::getinstance($this->Auth_SQL);
+        $this->assertTrue($result && is_a($result, 'RecordVersion'));
+    }
+
+    function test_setparam()
+    {
+        $this->RecordVersion->setparam(array('var'=>'val'));
+    }
+
+    function test_getparam()
+    {
+        $this->RecordVersion->getparam('var');
+    }
+
+    function test_create()
+    {
+        $result = $this->RecordVersion->create('test_user_tbl', 'user_id', '1', 'Test User', 'First version of user');
+        $this->assertTrue($result);
+    }
+
+    function test_restore()
+    {
+        $current = $this->RecordVersion->getCurrent('test_user_tbl', 'user_id', '1');
+        $version_id = $this->RecordVersion->create('test_user_tbl', 'user_id', '1', 'Test User', 'First version of user');
+        $versioned = $this->RecordVersion->getData($version_id);
+        $result = $this->RecordVersion->restore($version_id);
+        $restored = $this->RecordVersion->getCurrent('test_user_tbl', 'user_id', '1');
+        $this->assertTrue(is_array($result), 'Restore did not return array.');
+        $this->assertTrue($current === $versioned && $versioned === $restored, 'Restored version does not match original.');
+    }
+
+    function test_deleteold()
+    {
+        // Creat 3 test versions.
+        $this->RecordVersion->create('test_user_tbl', 'user_id', '1', 'Test 1', '1 version of user');
+        $this->RecordVersion->create('test_user_tbl', 'user_id', '1', 'Test 2', '2 version of user');
+        $this->RecordVersion->create('test_user_tbl', 'user_id', '1', 'Test 3', '3 version of user');
+
+        $a = $this->RecordVersion->getList('test_user_tbl', 'user_id', '1');
+
+        $this->RecordVersion->deleteold('test_user_tbl', 'user_id', '1');
+        $b = $this->RecordVersion->getList('test_user_tbl', 'user_id', '1');
+
+        $this->RecordVersion->setparam(array('max_qty'=>2));
+        $this->RecordVersion->setparam(array('min_qty'=>1));
+        $this->RecordVersion->setparam(array('min_days'=>0));
+        $this->RecordVersion->deleteold('test_user_tbl', 'user_id', '1');
+        $c = $this->RecordVersion->getList('test_user_tbl', 'user_id', '1');
+
+        $this->RecordVersion->setparam(array('max_qty'=>0));
+        $this->RecordVersion->setparam(array('min_qty'=>0));
+        $this->RecordVersion->setparam(array('min_days'=>0));
+        $this->RecordVersion->deleteold('test_user_tbl', 'user_id', '1');
+        $d = $this->RecordVersion->getList('test_user_tbl', 'user_id', '1');
+
+        $this->assertTrue(sizeof($a) == 3, 'A is wrong');
+        $this->assertTrue(sizeof($b) == 3, 'B is wrong');
+        $this->assertTrue(sizeof($c) == 1, 'C is wrong');
+        $this->assertTrue(sizeof($d) == 0, 'D is wrong');
+    }
+
+    function test_getlist()
+    {
+        $this->RecordVersion->create('test_user_tbl', 'user_id', '1', 'Test 1', '1 version of user');
+        $this->RecordVersion->create('test_user_tbl', 'user_id', '1', 'Test 2', '2 version of user');
+        $this->RecordVersion->create('test_user_tbl', 'user_id', '1', 'Test 3', '3 version of user');
+        $result = $this->RecordVersion->getList('test_user_tbl', 'user_id', '1');
+        $this->assertTrue(is_array($result) && !empty($result));
+    }
+
+    function test_getverson()
+    {
+        $version_id = $this->RecordVersion->create('test_user_tbl', 'user_id', '1', 'Test User', 'First version of user');
+        $result = $this->RecordVersion->getverson($version_id);
+        $this->assertTrue(is_array($result) && !empty($result));
+    }
+
+    function test_getdata()
+    {
+        $version_id = $this->RecordVersion->create('test_user_tbl', 'user_id', '1', 'Test User', 'First version of user');
+        $result = $this->RecordVersion->getdata($version_id);
+        $this->assertTrue(is_array($result) && !empty($result));
+    }
+
+    function test_getcurrent()
+    {
+        $result = $this->RecordVersion->getCurrent('test_user_tbl', 'user_id', '1');
+        $this->assertTrue(is_array($result) && !empty($result));
+    }
+
+}
+// Running the test.
+$suite = new PHPUnit_TestSuite('RecordVersionTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/ScriptTimerTest.php
===================================================================
--- trunk/tests/ScriptTimerTest.php	(revision 815)
+++ trunk/tests/ScriptTimerTest.php	(revision 1)
@@ -4,35 +4,14 @@
 
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
+ * PHPUnit test case for ScriptTimer
  * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
  * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/ScriptTimer.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class ScriptTimerTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class ScriptTimerTest extends PHPUnit_TestCase {
 
     var $ScriptTimer;
@@ -40,5 +19,5 @@
     function ScriptTimerTest($name)
     {
-        $this->PHPUnit_Framework_TestCase($name);
+        $this->PHPUnit_TestCase($name);
     }
 
@@ -77,2 +56,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('ScriptTimerTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/SessionCacheTest.php
===================================================================
--- trunk/tests/SessionCacheTest.php	(revision 1)
+++ trunk/tests/SessionCacheTest.php	(revision 1)
@@ -0,0 +1,90 @@
+<?php
+/// FIXME: Tests not implemented.
+return;
+
+/**
+ * PHPUnit test case for SessionCache
+ * 
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
+ * 
+ * Created with PHPUnit_Skeleton on 2005-08-09
+ */
+require_once 'PHPUnit.php';
+class SessionCacheTest extends PHPUnit_TestCase {
+
+    var $SessionCache;
+
+    function SessionCacheTest($name)
+    {
+        $this->PHPUnit_TestCase($name);
+    }
+
+    function setUp()
+    {
+        require dirname(__FILE__) . '/_config.inc.php';
+        require_once '../lib/SessionCache.inc.php';
+        $this->SessionCache =& new SessionCache(PARAM);
+    }
+
+    function tearDown()
+    {
+        unset($this->SessionCache);
+    }
+
+    function test_getinstance()
+    {
+        $result = $this->SessionCache->getinstance(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_setparam()
+    {
+        $result = $this->SessionCache->setparam(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_getparam()
+    {
+        $result = $this->SessionCache->getparam(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_putcache()
+    {
+        $result = $this->SessionCache->putcache(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_getcache()
+    {
+        $result = $this->SessionCache->getcache(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_iscached()
+    {
+        $result = $this->SessionCache->iscached(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+    function test_breakcache()
+    {
+        $result = $this->SessionCache->breakcache(PARAM);
+        $expected = EXPECTED_VAL;
+        $this->assertEquals($expected, $result);
+    }
+
+}
+// Running the test.
+$suite = new PHPUnit_TestSuite('SessionCacheTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/SortOrderTest.php
===================================================================
--- trunk/tests/SortOrderTest.php	(revision 815)
+++ trunk/tests/SortOrderTest.php	(revision 1)
@@ -4,35 +4,14 @@
 
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
+ * PHPUnit test case for SortOrder
  * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
  * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/SortOrder.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class SortOrderTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class SortOrderTest extends PHPUnit_TestCase {
 
     var $SortOrder;
@@ -40,5 +19,5 @@
     function SortOrderTest($name)
     {
-        $this->PHPUnit_Framework_TestCase($name);
+        $this->PHPUnit_TestCase($name);
     }
 
@@ -91,2 +70,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('SortOrderTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/SpellCheckTest.php
===================================================================
--- trunk/tests/SpellCheckTest.php	(revision 815)
+++ trunk/tests/SpellCheckTest.php	(revision 1)
@@ -4,35 +4,14 @@
 
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
+ * PHPUnit test case for SpellCheck
  * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
  * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/SpellCheck.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class SpellCheckTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class SpellCheckTest extends PHPUnit_TestCase {
 
     var $SpellCheck;
@@ -40,5 +19,5 @@
     function SpellCheckTest($name)
     {
-        $this->PHPUnit_Framework_TestCase($name);
+        $this->PHPUnit_TestCase($name);
     }
 
@@ -154,2 +133,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('SpellCheckTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/TemplateGlueTest.php
===================================================================
--- trunk/tests/TemplateGlueTest.php	(revision 815)
+++ trunk/tests/TemplateGlueTest.php	(revision 1)
@@ -4,35 +4,14 @@
 
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
+ * PHPUnit test case for TemplateGlue
  * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
  * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/TemplateGlue.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class TemplateGlueTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class TemplateGlueTest extends PHPUnit_TestCase {
 
     var $TemplateGlue;
@@ -40,5 +19,5 @@
     function TemplateGlueTest($name)
     {
-        $this->PHPUnit_Framework_TestCase($name);
+        $this->PHPUnit_TestCase($name);
     }
 
@@ -56,2 +35,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('TemplateGlueTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/UploadTest.php
===================================================================
--- trunk/tests/UploadTest.php	(revision 815)
+++ trunk/tests/UploadTest.php	(revision 1)
@@ -4,35 +4,14 @@
 
 /**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- *
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/Upload.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
+ * PHPUnit test case for Upload
+ * 
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
+ * 
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
-
-class UploadTest extends PHPUnit_Framework_TestCase {
+require_once 'PHPUnit.php';
+class UploadTest extends PHPUnit_TestCase {
 
     var $Upload;
@@ -40,5 +19,5 @@
     function UploadTest($name)
     {
-        $this->PHPUnit_Framework_TestCase($name);
+        $this->PHPUnit_TestCase($name);
     }
 
@@ -120,5 +99,5 @@
     function test_getfilenameextension()
     {
-        $result = $this->Upload::getfilenameextension(PARAM);
+        $result = $this->Upload->getfilenameextension(PARAM);
         $expected = EXPECTED_VAL;
         $this->assertEquals($expected, $result);
@@ -126,2 +105,7 @@
 
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('UploadTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/UtilitiesTest.php
===================================================================
--- trunk/tests/UtilitiesTest.php	(revision 815)
+++ trunk/tests/UtilitiesTest.php	(revision 1)
@@ -1,328 +1,41 @@
 <?php
-/**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- *
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
+/// FIXME: Tests not implemented.
+return;
 
 /**
- * PHPUnit test case for codebase/lib/Utilities.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
+ * PHPUnit test case for Utilities
+ * 
+ * The method skeletons below need to be filled in with 
+ * real data so that the tests will run correctly. Replace 
+ * all EXPECTED_VAL and PARAM strings with real data. 
+ * 
  * Created with PHPUnit_Skeleton on 2005-08-09
  */
+require_once 'PHPUnit.php';
+class UtilitiesTest extends PHPUnit_TestCase {
 
-class UtilitiesTest extends PHPUnit_Framework_TestCase {
+    var $Utilities;
+
+    function UtilitiesTest($name)
+    {
+        $this->PHPUnit_TestCase($name);
+    }
 
     function setUp()
     {
-        // define('_CLI', true);
         require dirname(__FILE__) . '/_config.inc.php';
         require_once '../lib/Utilities.inc.php';
-        // $this->Utilities =& new Utilities(PARAM);
+        $this->Utilities =& new Utilities(PARAM);
     }
 
     function tearDown()
     {
-        $app =& App::getInstance();
-        $app->stop();
+        unset($this->Utilities);
     }
 
-    function test_hyperlinkTxt()
-    {
-        $urls = [
-            ' http://www.asdf.com/ ' => ' <a href="http://www.asdf.com/">www.asdf.com</a> ',
-            ' ws://www.asdf.com/ ' => ' <a href="ws://www.asdf.com/">ws://www.asdf.com/</a> ',
-            ' sftp://user@host.tld:22/path/x ' => ' <a href="sftp://user@host.tld:22/path/x">sftp://user@host.tld:22/path/x</a> ',
-            ' www.asdf.com/ ' => ' <a href="http://www.asdf.com/">www.asdf.com</a> ',
-            ' http://asdf/ ' => ' <a href="http://asdf/">asdf</a> ',
-            ' www.asdf.com/? ' => ' <a href="http://www.asdf.com/">www.asdf.com</a>? ',
-            ' www.asdf.com/?x=y+z ' => ' <a href="http://www.asdf.com/?x=y+z">www.asdf.com/?x=y+z</a> ',
-            ' www.asdf.com/?x=y+ ' => ' <a href="http://www.asdf.com/?x=y+">www.asdf.com/?x=y+</a> ',
-            ' www.asdf.com/?x= ' => ' <a href="http://www.asdf.com/?x=">www.asdf.com/?x=</a> ',
-            ' www.asdf.com/?x ' => ' <a href="http://www.asdf.com/?x">www.asdf.com/?x</a> ',
-            ' www.asdf.com/?â€ïž=ð¥ ' => ' <a href="http://www.asdf.com/?â€ïž=ð¥">www.asdf.com/?â€ïž=ð¥</a> ',
-            ' www.asdf.com? ' => ' <a href="http://www.asdf.com">www.asdf.com</a>? ',
-            ' www.asdf.com! ' => ' <a href="http://www.asdf.com">www.asdf.com</a>! ',
-            ' www.asdf.com. ' => ' <a href="http://www.asdf.com">www.asdf.com</a>. ',
-            ' `www.asdf.com` ' => ' `www.asdf.com` ',
-            ' "www.asdf.com" ' => ' "www.asdf.com" ',
-            ' <www.asdf.com> ' => ' <<a href="http://www.asdf.com">www.asdf.com</a>> ',
-            ' <http://www.asdf.com> ' => ' <<a href="http://www.asdf.com">www.asdf.com</a>> ',
-            ' (http://www.asdf.com) ' => ' (<a href="http://www.asdf.com">www.asdf.com</a>) ',
-            ' (URL: http://www.asdf.com#1) ' => ' (URL: <a href="http://www.asdf.com#1">www.asdf.com#1</a>) ',
-            ' <a href="http://www.example.com/">Click Here</a> ' => ' <a href="http://www.example.com/">Click Here</a> ',
-            ' <a href="http://www.example.com/">http://www.example.com/</a> ' => ' <a href="http://www.example.com/">http://www.example.com/</a> ',
-            ' <a href=http://www.example.com/>http://www.example.com/</a> ' => ' <a href=http://www.example.com/>http://www.example.com/</a> ',
-            ' <a href=\'http://www.example.com/\' >http://www.example.com/</a> ' => ' <a href=\'http://www.example.com/\' >http://www.example.com/</a> ',
-            ' http://foo.com/blah_blah ' => ' <a href="http://foo.com/blah_blah">foo.com/blah_blah</a> ',
-            ' http://foo.com/blah_blah/ ' => ' <a href="http://foo.com/blah_blah/">foo.com/blah_blah/</a> ',
-            ' http://foo.com/blah_blah_(wikipedia) ' => ' <a href="http://foo.com/blah_blah_(wikipedia">foo.com/blah_blah_(wikipedia</a>) ',
-            ' http://foo.com/blah_blah_(wikipedia)_(again) ' => ' <a href="http://foo.com/blah_blah_(wikipedia)_(again">foo.com/blah_blah_(wikipedia)_(again</a>) ',
-            ' http://www.example.com/wpstyle/?p=364 ' => ' <a href="http://www.example.com/wpstyle/?p=364">www.example.com/wpstyle/?p=364</a> ',
-            ' https://www.example.com/foo/?bar=baz&inga=42&quux ' => ' <a href="https://www.example.com/foo/?bar=baz&amp;inga=42&amp;quux">www.example.com/foo/?bar=baz&inga=42&quux</a> ',
-            ' http://âªdf.ws/123 ' => ' <a href="http://âªdf.ws/123">âªdf.ws/123</a> ',
-            ' http://userid:password@example.com:8080 ' => ' <a href="http://userid:password@example.com:8080">userid:password@example.com:8080</a> ',
-            ' http://userid:password@example.com:8080/ ' => ' <a href="http://userid:password@example.com:8080/">userid:password@example.com:8080</a> ',
-            ' http://userid@example.com ' => ' <a href="http://userid@example.com">userid@example.com</a> ',
-            ' http://userid@example.com/ ' => ' <a href="http://userid@example.com/">userid@example.com</a> ',
-            ' http://userid@example.com:8080 ' => ' <a href="http://userid@example.com:8080">userid@example.com:8080</a> ',
-            ' http://userid@example.com:8080/ ' => ' <a href="http://userid@example.com:8080/">userid@example.com:8080</a> ',
-            ' http://userid:password@example.com ' => ' <a href="http://userid:password@example.com">userid:password@example.com</a> ',
-            ' http://userid:password@example.com/ ' => ' <a href="http://userid:password@example.com/">userid:password@example.com</a> ',
-            ' http://142.42.1.1/ ' => ' <a href="http://142.42.1.1/">142.42.1.1</a> ',
-            ' http://142.42.1.1:8080/ ' => ' <a href="http://142.42.1.1:8080/">142.42.1.1:8080</a> ',
-            ' http://â¡.ws/äš¹ ' => ' <a href="http://â¡.ws/äš¹">â¡.ws/äš¹</a> ',
-            ' http://â.ws ' => ' <a href="http://â.ws">â.ws</a> ',
-            ' http://â.ws/ ' => ' <a href="http://â.ws/">â.ws</a> ',
-            ' http://foo.com/blah_(wikipedia)#cite-1 ' => ' <a href="http://foo.com/blah_(wikipedia)#cite-1">foo.com/blah_(wikipedia)#cite-1</a> ',
-            ' http://foo.com/blah_(wikipedia)_blah#cite-1 ' => ' <a href="http://foo.com/blah_(wikipedia)_blah#cite-1">foo.com/blah_(wikipedia)_blah#cite-1</a> ',
-            ' http://foo.com/unicode_(âª)_in_parens ' => ' <a href="http://foo.com/unicode_(âª)_in_parens">foo.com/unicode_(âª)_in_parens</a> ',
-            ' http://foo.com/(something)?after=parens ' => ' <a href="http://foo.com/(something)?after=parens">foo.com/(something)?after=parens</a> ',
-            ' http://âº.damowmow.com/ ' => ' <a href="http://âº.damowmow.com/">âº.damowmow.com</a> ',
-            ' http://code.google.com/events/#&product=browser ' => ' <a href="http://code.google.com/events/#&amp;product=browser">code.google.com/events/#&product=browser</a> ',
-            ' http://j.mp ' => ' <a href="http://j.mp">j.mp</a> ',
-            ' ftp://foo.bar/baz ' => ' <a href="ftp://foo.bar/baz">ftp://foo.bar/baz</a> ',
-            ' http://foo.bar/?q=Test%20URL-encoded%20stuff ' => ' <a href="http://foo.bar/?q=Test%20URL-encoded%20stuff">foo.bar/?q=Test%20URL-encoded%20stuff</a> ',
-            ' http://Ù
-Ø«Ø§Ù.Ø¥Ø®ØªØšØ§Ø± ' => ' <a href="http://Ù
-Ø«Ø§Ù.Ø¥Ø®ØªØšØ§Ø±">Ù
-Ø«Ø§Ù.Ø¥Ø®ØªØšØ§Ø±</a> ',
-            ' http://äŸå­.æµè¯ ' => ' <a href="http://äŸå­.æµè¯">äŸå­.æµè¯</a> ',
-            ' http://à€à€Šà€Ÿà€¹à€°à€£.à€ªà€°à¥à€à¥à€·à€Ÿ ' => ' <a href="http://à€à€Šà€Ÿà€¹à€°à€£.à€ªà€°à¥à€à¥à€·à€Ÿ">à€à€Šà€Ÿà€¹à€°à€£.à€ªà€°à¥à€à¥à€·à€Ÿ</a> ',
-            ' http://-.~_!$&\'()*+,;=:%40:80%2f::::::@example.com ' => ' <a href="http://-.~_!$&amp;&#039;()*+,;=:%40:80%2f::::::@example.com">-.~_!$&\'()*+,;=:%40:80%2f::::::@example.com</a> ',
-            ' http://1337.net ' => ' <a href="http://1337.net">1337.net</a> ',
-            ' http://a.b-c.de ' => ' <a href="http://a.b-c.de">a.b-c.de</a> ',
-            ' http://223.255.255.254 ' => ' <a href="http://223.255.255.254">223.255.255.254</a> ',
-            ' http://x and.co OK?' => ' http://x and.co OK?',
-            ' http://foo.bar?q=Spaces should be encoded ' => ' <a href="http://foo.bar?q=Spaces">foo.bar?q=Spaces</a> should be encoded ',
-            ' https://github.com/search?utf8=â&q=gif ' => ' <a href="https://github.com/search?utf8=â&amp;q=gif">github.com/search?utf8=â&q=gif</a> ',
-            ' https://github.com/search?q=gif&utf8=* ' => ' <a href="https://github.com/search?q=gif&amp;utf8=*">github.com/search?q=gif&utf8=*</a> ',
-            ' https://github.com/search?q=gif&utf8=â ' => ' <a href="https://github.com/search?q=gif&amp;utf8=â">github.com/search?q=gif&utf8=â</a> ',
-
-            // These should fail.
-            ' http://x and.co OK?' => ' http://x and.co OK?',
-            ' www. ' => ' www. ',
-            ' www.x ' => ' www.x ',
-            ' http: ' => ' http: ',
-            ' http:// ' => ' http:// ',
-            ' http:x ' => ' http:x ',
-            ' http://x ' => ' http://x ',
-            ' http://x/ ' => ' http://x/ ',
-            ' http:// ?.x.com/ ' => ' http:// ?.x.com/ ',
-            ' http://?.com/ ' => ' http://?.com/ ',
-            ' http://.?.com/ ' => ' http://.?.com/ ',
-
-            // These are allowed to fuckup due to limitations in our ability to be omnipotent.
-            ' http:// www.x.com/ ' => ' http:// <a href="http://www.x.com/">www.x.com</a> ',
-            ' <a href=http://www.example.com/ > http://www.example.com/</a> ' => ' <a href=http://www.example.com/ > <a href="http://www.example.com/">www.example.com</a></a> ',
-
-            '<a href="http://www.example.com">Lorem ipsum</a> <a href="sftp://user@host.tld/path">dolor sit amet</a> sftp://user@host.tld/path, [http://www.example.com/ consetetur] sadipscing elitr, (sed diam) www.example.com! Nonumy http://x.com! Invidunt mailto:asdf@asdf.com ut <a href="mailto:asdf@asdf.com">asdf@asdf.com</a> \'\'\'et dolore\'\'\' magna. <!-- comment -->  Aliquyam:erat, sed://diam //voluptua//. At vero.eos.et {{{ for (var i = Things.length - 1; i >= 0; i--) { Things[i]; } }}} `http://x.com` justo duo doloreshttp://www.not.com!' => '<a href="http://www.example.com">Lorem ipsum</a> <a href="sftp://user@host.tld/path">dolor sit amet</a> <a href="sftp://user@host.tld/path">sftp://user@host.tld/path</a>, [<a href="http://www.example.com/">www.example.com</a> consetetur] sadipscing elitr, (sed diam) <a href="http://www.example.com">www.example.com</a>! Nonumy <a href="http://x.com">x.com</a>! Invidunt <a href="mailto:asdf@asdf.com">mailto:asdf@asdf.com</a> ut <a href="mailto:asdf@asdf.com">asdf@asdf.com</a> \'\'\'et dolore\'\'\' magna. <!-- comment -->  Aliquyam:erat, <a href="sed://diam">sed://diam</a> //voluptua//. At vero.eos.et {{{ for (var i = Things.length - 1; i >= 0; i--) { Things[i]; } }}} `http://x.com` justo duo <a href="doloreshttp://www.not.com">doloreshttp://www.not.com</a>!',
-        ];
-
-        $urls_strict = [
-            ' http://www.asdf.com/ ' => ' <a href="http://www.asdf.com/">www.asdf.com</a> ',
-            ' ws://www.asdf.com/ ' => ' <a href="ws://www.asdf.com/">ws://www.asdf.com/</a> ',
-            ' sftp://user@host.tld:22/path/x ' => ' <a href="sftp://user@host.tld:22/path/x">sftp://user@host.tld:22/path/x</a> ',
-            ' sip:beer ' => ' <a href="sip:beer">sip:beer</a> ',
-            ' http://asdf/ ' => ' <a href="http://asdf/">asdf</a> ',
-            ' http://www.asdf.com/? ' => ' <a href="http://www.asdf.com/?">www.asdf.com/?</a> ',
-            ' http://www.asdf.com/?x=y+z ' => ' <a href="http://www.asdf.com/?x=y+z">www.asdf.com/?x=y+z</a> ',
-            ' http://www.asdf.com/?x=y+ ' => ' <a href="http://www.asdf.com/?x=y+">www.asdf.com/?x=y+</a> ',
-            ' http://www.asdf.com/?x= ' => ' <a href="http://www.asdf.com/?x=">www.asdf.com/?x=</a> ',
-            ' http://www.asdf.com/?x ' => ' <a href="http://www.asdf.com/?x">www.asdf.com/?x</a> ',
-            ' https://www.asdf.com/?â€ïž=ð¥ ' => ' <a href="https://www.asdf.com/?â€ïž=ð¥">www.asdf.com/?â€ïž=ð¥</a> ',
-            ' www.asdf.com? ' => ' www.asdf.com? ',
-            ' www.asdf.com/ ' => ' www.asdf.com/ ',
-            ' www.asdf.com/? ' => ' www.asdf.com/? ',
-            ' www.asdf.com/?x=y+z ' => ' www.asdf.com/?x=y+z ',
-            ' www.asdf.com/?x=y+ ' => ' www.asdf.com/?x=y+ ',
-            ' www.asdf.com/?x= ' => ' www.asdf.com/?x= ',
-            ' www.asdf.com/?x ' => ' www.asdf.com/?x ',
-            ' www.asdf.com/?â€ïž=ð¥ ' => ' www.asdf.com/?â€ïž=ð¥ ',
-            ' www.asdf.com! ' => ' www.asdf.com! ',
-            ' www.asdf.com. ' => ' www.asdf.com. ',
-            ' `www.asdf.com` ' => ' `www.asdf.com` ',
-            ' "www.asdf.com" ' => ' "www.asdf.com" ',
-            ' <www.asdf.com> ' => ' <www.asdf.com> ',
-            ' `http://www.asdf.com` ' => ' `http://www.asdf.com` ',
-            ' "http://www.asdf.com" ' => ' "http://www.asdf.com" ',
-            ' <http://www.asdf.com> ' => ' <<a href="http://www.asdf.com">www.asdf.com</a>> ',
-            ' (http://www.asdf.com) ' => ' (<a href="http://www.asdf.com)">www.asdf.com)</a> ',
-            ' (URL: http://www.asdf.com#1) ' => ' (URL: <a href="http://www.asdf.com#1)">www.asdf.com#1)</a> ',
-            ' <a href="http://www.example.com/">Click Here</a> ' => ' <a href="http://www.example.com/">Click Here</a> ',
-            ' <a href="http://www.example.com/">http://www.example.com/</a> ' => ' <a href="http://www.example.com/">http://www.example.com/</a> ',
-            ' <a href=http://www.example.com/>http://www.example.com/</a> ' => ' <a href=http://www.example.com/>http://www.example.com/</a> ',
-            ' <a href=\'http://www.example.com/\' >http://www.example.com/</a> ' => ' <a href=\'http://www.example.com/\' >http://www.example.com/</a> ',
-            ' http://foo.com/blah_blah ' => ' <a href="http://foo.com/blah_blah">foo.com/blah_blah</a> ',
-            ' http://foo.com/blah_blah/ ' => ' <a href="http://foo.com/blah_blah/">foo.com/blah_blah/</a> ',
-            ' http://foo.com/blah_blah_(wikipedia) ' => ' <a href="http://foo.com/blah_blah_(wikipedia)">foo.com/blah_blah_(wikipedia)</a> ',
-            ' http://foo.com/blah_blah_(wikipedia)_(again) ' => ' <a href="http://foo.com/blah_blah_(wikipedia)_(again)">foo.com/blah_blah_(wikipedia)_(again)</a> ',
-            ' http://www.example.com/wpstyle/?p=364 ' => ' <a href="http://www.example.com/wpstyle/?p=364">www.example.com/wpstyle/?p=364</a> ',
-            ' https://www.example.com/foo/?bar=baz&inga=42&quux ' => ' <a href="https://www.example.com/foo/?bar=baz&amp;inga=42&amp;quux">www.example.com/foo/?bar=baz&inga=42&quux</a> ',
-            ' http://âªdf.ws/123 ' => ' <a href="http://âªdf.ws/123">âªdf.ws/123</a> ',
-            ' http://userid:password@example.com:8080 ' => ' <a href="http://userid:password@example.com:8080">userid:password@example.com:8080</a> ',
-            ' http://userid:password@example.com:8080/ ' => ' <a href="http://userid:password@example.com:8080/">userid:password@example.com:8080</a> ',
-            ' http://userid@example.com ' => ' <a href="http://userid@example.com">userid@example.com</a> ',
-            ' http://userid@example.com/ ' => ' <a href="http://userid@example.com/">userid@example.com</a> ',
-            ' http://userid@example.com:8080 ' => ' <a href="http://userid@example.com:8080">userid@example.com:8080</a> ',
-            ' http://userid@example.com:8080/ ' => ' <a href="http://userid@example.com:8080/">userid@example.com:8080</a> ',
-            ' http://userid:password@example.com ' => ' <a href="http://userid:password@example.com">userid:password@example.com</a> ',
-            ' http://userid:password@example.com/ ' => ' <a href="http://userid:password@example.com/">userid:password@example.com</a> ',
-            ' http://142.42.1.1/ ' => ' <a href="http://142.42.1.1/">142.42.1.1</a> ',
-            ' http://142.42.1.1:8080/ ' => ' <a href="http://142.42.1.1:8080/">142.42.1.1:8080</a> ',
-            ' http://â¡.ws/äš¹ ' => ' <a href="http://â¡.ws/äš¹">â¡.ws/äš¹</a> ',
-            ' http://â.ws ' => ' <a href="http://â.ws">â.ws</a> ',
-            ' http://â.ws/ ' => ' <a href="http://â.ws/">â.ws</a> ',
-            ' http://foo.com/blah_(wikipedia)#cite-1 ' => ' <a href="http://foo.com/blah_(wikipedia)#cite-1">foo.com/blah_(wikipedia)#cite-1</a> ',
-            ' http://foo.com/blah_(wikipedia)_blah#cite-1 ' => ' <a href="http://foo.com/blah_(wikipedia)_blah#cite-1">foo.com/blah_(wikipedia)_blah#cite-1</a> ',
-            ' http://foo.com/unicode_(âª)_in_parens ' => ' <a href="http://foo.com/unicode_(âª)_in_parens">foo.com/unicode_(âª)_in_parens</a> ',
-            ' http://foo.com/(something)?after=parens ' => ' <a href="http://foo.com/(something)?after=parens">foo.com/(something)?after=parens</a> ',
-            ' http://âº.damowmow.com/ ' => ' <a href="http://âº.damowmow.com/">âº.damowmow.com</a> ',
-            ' http://code.google.com/events/#&product=browser ' => ' <a href="http://code.google.com/events/#&amp;product=browser">code.google.com/events/#&product=browser</a> ',
-            ' http://j.mp ' => ' <a href="http://j.mp">j.mp</a> ',
-            ' ftp://foo.bar/baz ' => ' <a href="ftp://foo.bar/baz">ftp://foo.bar/baz</a> ',
-            ' http://foo.bar/?q=Test%20URL-encoded%20stuff ' => ' <a href="http://foo.bar/?q=Test%20URL-encoded%20stuff">foo.bar/?q=Test%20URL-encoded%20stuff</a> ',
-            ' http://Ù
-Ø«Ø§Ù.Ø¥Ø®ØªØšØ§Ø± ' => ' <a href="http://Ù
-Ø«Ø§Ù.Ø¥Ø®ØªØšØ§Ø±">Ù
-Ø«Ø§Ù.Ø¥Ø®ØªØšØ§Ø±</a> ',
-            ' http://äŸå­.æµè¯ ' => ' <a href="http://äŸå­.æµè¯">äŸå­.æµè¯</a> ',
-            ' http://à€à€Šà€Ÿà€¹à€°à€£.à€ªà€°à¥à€à¥à€·à€Ÿ ' => ' <a href="http://à€à€Šà€Ÿà€¹à€°à€£.à€ªà€°à¥à€à¥à€·à€Ÿ">à€à€Šà€Ÿà€¹à€°à€£.à€ªà€°à¥à€à¥à€·à€Ÿ</a> ',
-            ' http://-.~_!$&\'()*+,;=:%40:80%2f::::::@example.com ' => ' <a href="http://-.~_!$&amp;&#039;()*+,;=:%40:80%2f::::::@example.com">-.~_!$&\'()*+,;=:%40:80%2f::::::@example.com</a> ',
-            ' http://1337.net ' => ' <a href="http://1337.net">1337.net</a> ',
-            ' http://a.b-c.de ' => ' <a href="http://a.b-c.de">a.b-c.de</a> ',
-            ' http://223.255.255.254 ' => ' <a href="http://223.255.255.254">223.255.255.254</a> ',
-            ' http://foo.bar?q=Spaces should be encoded ' => ' <a href="http://foo.bar?q=Spaces">foo.bar?q=Spaces</a> should be encoded ',
-            ' https://github.com/search?utf8=â&q=gif ' => ' <a href="https://github.com/search?utf8=â&amp;q=gif">github.com/search?utf8=â&q=gif</a> ',
-            ' https://github.com/search?q=gif&utf8=* ' => ' <a href="https://github.com/search?q=gif&amp;utf8=*">github.com/search?q=gif&utf8=*</a> ',
-            ' https://github.com/search?q=gif&utf8=â ' => ' <a href="https://github.com/search?q=gif&amp;utf8=â">github.com/search?q=gif&utf8=â</a> ',
-
-            // Unusual schemes.
-            ' view-source:https://trac.strangecode.com/x/ticket/2#comment:4 ' => ' <a href="view-source:https://trac.strangecode.com/x/ticket/2#comment:4">view-source:https://trac.strangecode.com/x/ticket/2#comment:4</a> ',
-            ' mailto:asdf@asdf.com ' => ' <a href="mailto:asdf@asdf.com">mailto:asdf@asdf.com</a> ',
-            ' facetime://+19995551234 ' => ' <a href="facetime://+19995551234">facetime://+19995551234</a> ',
-            ' tel:+15552001010 ' => ' <a href="tel:+15552001010">tel:+15552001010</a> ',
-            ' magnet:?xt=urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1&xt=urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY&xt=urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q&xl=10826029&dn=mediawiki-1.15.1.tar.gz&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&as=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz&xs=http%3A%2F%2Fcache.example.org%2FXRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5&xs=dchub://example.org ' => ' <a href="magnet:?xt=urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1&amp;xt=urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY&amp;xt=urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q&amp;xl=10826029&amp;dn=mediawiki-1.15.1.tar.gz&amp;tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&amp;as=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz&amp;xs=http%3A%2F%2Fcache.example.org%2FXRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5&amp;xs=dchub://example.org">magnet:?xt=urn:ed2k:354B15E68FB8F36D7CD88FF94116CDC1&xt=urn:tree:tiger:7N5OAMRNGMSSEUE3ORHOKWN4WWIQ5X4EBOOTLJY&xt=urn:btih:QHQXPYWMACKDWKP47RRVIV7VOURXFE5Q&xl=10826029&dn=mediawiki-1.15.1.tar.gz&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&as=http%3A%2F%2Fdownload.wikimedia.org%2Fmediawiki%2F1.15%2Fmediawiki-1.15.1.tar.gz&xs=http%3A%2F%2Fcache.example.org%2FXRX2PEFXOOEJFRVUCX6HMZMKS5TWG4K5&xs=dchub://example.org</a> ',
-            ' chrome-extension://71f05c488a96b441ef679b09267ea46c/index.html ' => ' <a href="chrome-extension://71f05c488a96b441ef679b09267ea46c/index.html">chrome-extension://71f05c488a96b441ef679b09267ea46c/index.html</a> ',
-
-            // These should fail.
-            ' http://x and.co OK?' => ' http://x and.co OK?',
-            ' www. ' => ' www. ',
-            ' www.x ' => ' www.x ',
-            ' http: ' => ' http: ',
-            ' http:// ' => ' http:// ',
-            ' http:x ' => ' http:x ',
-            ' http://x ' => ' http://x ',
-            ' http://x/ ' => ' http://x/ ',
-            ' http:// www.x.com/ ' => ' http:// www.x.com/ ',
-            ' http://?.com/ ' => ' http://?.com/ ',
-            ' http://.?.com/ ' => ' http://.?.com/ ',
-
-            // These are allowed to fuckup due to limitations in our ability to be omnipotent.
-            ' <a href=http://www.example.com/ > http://www.example.com/</a> ' => ' <a href=http://www.example.com/ > <a href="http://www.example.com/">www.example.com</a></a> ',
-            ' dummyhttp://www.asdf.com/ ' => ' <a href="dummyhttp://www.asdf.com/">dummyhttp://www.asdf.com/</a> ',
-
-            '<a href="http://www.example.com">Lorem ipsum</a> <a href="sftp://user@host.tld/path">dolor sit amet</a> sftp://user@host.tld/path, [http://www.example.com/ consetetur] sadipscing elitr, (sed diam) www.example.com! Nonumy http://x.com! Invidunt mailto:asdf@asdf.com ut <a href="mailto:asdf@asdf.com">asdf@asdf.com</a> \'\'\'et dolore\'\'\' magna. <!-- comment -->  Aliquyam:erat, sed://diam //voluptua//. At vero.eos.et {{{ for (var i = Things.length - 1; i >= 0; i--) { Things[i]; } }}} `http://x.com` justo duo doloreshttp://www.not.com!' => '<a href="http://www.example.com">Lorem ipsum</a> <a href="sftp://user@host.tld/path">dolor sit amet</a> <a href="sftp://user@host.tld/path,">sftp://user@host.tld/path,</a> [<a href="http://www.example.com/">www.example.com</a> consetetur] sadipscing elitr, (sed diam) www.example.com! Nonumy <a href="http://x.com!">x.com!</a> Invidunt <a href="mailto:asdf@asdf.com">mailto:asdf@asdf.com</a> ut <a href="mailto:asdf@asdf.com">asdf@asdf.com</a> \'\'\'et dolore\'\'\' magna. <!-- comment -->  Aliquyam:erat, <a href="sed://diam">sed://diam</a> //voluptua//. At vero.eos.et {{{ for (var i = Things.length - 1; i >= 0; i--) { Things[i]; } }}} `http://x.com` justo duo <a href="doloreshttp://www.not.com!">doloreshttp://www.not.com!</a>',
-        ];
-        foreach ($urls as $input => $expected) {
-            $result = hyperlinkTxt($input, false);
-            $this->assertEquals($expected, $result, sprintf('Failed with input: %s', $input));
-        }
-        foreach ($urls_strict as $input => $expected) {
-            // printf("'%s' => '%s',\n", $input, hyperlinkTxt($input, true));
-            $result = hyperlinkTxt($input, true);
-            $this->assertEquals($expected, $result, sprintf('Failed with input: %s', $input));
-        }
-    }
-
-    function test_fancyTxt()
-    {
-        $strings = [
-            'Due to the <a href="https://en.wikipedia.org/wiki/Camp_Fire_(2018)">fires in "Paradise," CA</a> it\'s a bad day.' => 'â¢ Due to the <a href="https://en.wikipedia.org/wiki/Camp_Fire_(2018)">fires in âParadise,â CA</a> itâs a bad day.',
-            'Simply--"\'check back\' later"--in 6\'3"...' => 'â¢ Simply â ââcheck backâ laterâ â in 6\'3"âŠ',
-            '"Double "double \'single\'""--?' => 'â¢ "Double âdouble âsingleââ" â ?',
-            '<a href="javascript:openPopup(\'/foo/bar.php\')">Click here</a>....' => 'â¢ <a href="javascript:openPopup(\'/foo/bar.php\')">Click here</a>....',
-            'If you have any questions please <a href="/contact/">contact the ants\' mailboxes</a>.' => 'â¢ If you have any questions please <a href="/contact/">contact the antsâ mailboxes</a>.',
-            'This URL: "http://äŸå­.å·ç­çºž/?x=y&1=2#asdf"' => 'â¢ This URL: âhttp://äŸå­.å·ç­çºž/?x=y&1=2#asdfâ',
-            // '\'...\' and "..."' => 'â¢ ââŠâ and ââŠâ', // FIXME: this one doesn't work.
-            '\'1...\' and "2..."' => 'â¢ â1âŠâ and â2âŠâ',
-            '\'One\'s self...\' and "Twosome"' => 'â¢ âOneâs selfâŠâ and âTwosomeâ',
-            '"\'Well,\' said I, \'the gentleman at No. 4.\'"' => 'â¢ ââWell,â said I, âthe gentleman at No. 4.ââ',
-            '"...an office in Leadenhall Street--and--"
-"O\'Reilly\'s office?"
-"What!" he roared.
-"Yes, to-day."* She stood smiling.'
-=>
-'â¢ ââŠan office in Leadenhall Street â and â â
-âOâReillyâs office?â
-âWhat!â he roared.
-âYes, to-day.â* She stood smiling.',
-        ];
-        foreach ($strings as $input => $expected) {
-            $result = fancyTxt($input, ['/^/', '/^Â·/'], ['Â· ', 'â¢']);
-            $this->assertEquals($expected, $result, sprintf('Failed with input: %s', $input));
-        }
-    }
-
-    function test_URLSlug()
-    {
-        $strings = [
-            'This becomes a slug' => 'this-becomes-a-slug',
-            'http://äŸå­.å·ç­çºž/?x=y&1=2#asdf' => 'http-%e4%be%8b%e5%ad%90-%e5%8d%b7%e7%ad%92%e7%ba%b8-x-yand1-2-asdf',
-            'Ã Ã€ Ã Ã¶ Ã ÃŒ Ã a Ã ÃŠ Ã Ãž Ã
- Ã¥' => 'a-a-o-o-u-u-sz-a-ae-ae-o-o-a-a',
-            ' - ' => '',
-            '' => '',
-            ' ' => '',
-            '?' => '',
-            'a file.JPG' => 'a-file-jpg',
-            '/a/path/file.JPG' => 'a-path-file-jpg',
-            '/a/directory/' => 'a-directory',
-            '/' => '',
-            'this-is-already-a-slug' => 'this-is-already-a-slug',
-            'HTML entities&nbsp;ok&mdash;or not!' => 'html-entities-ok-or-not',
-            '<p>tagsâŠ</p>' => 'ltpgttagshelliplt-pgt',
-            'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.' => 'lorem-ipsum-dolor-sit-amet-consetetur-sadipscing-elitr-sed-diam-nonumy-eirmod-tempor-invidunt-ut-labore-et-dolore-magna-aliquyam-erat-sed-diam-voluptua-at-vero-eos-et-accusam-et-justo-duo-dolores-et-ea-rebum-stet-clita-kasd-gubergren-no-sea-takimata-sanctus-est-lorem-ipsum-dolor-sit-amet-lorem-ipsum-dolor-sit-amet-consetetur-sadipscing-elitr-sed-diam-nonumy-eirmod-tempor-invidunt-ut-labore-et-dolore-magna-aliquyam-erat-sed-diam-voluptua-at-vero-eos-et-accusam-et-justo-duo-dolores-et-ea-rebum-stet-clita-kasd-gubergren-no-sea-takimata-sanctus-est-lorem-ipsum-dolor-sit-amet-lorem-ipsum-dolor-sit-amet-consetetur-sadipscing-elitr-sed-diam-nonumy-eirmod-tempor-invidunt-ut-labore-et-dolore-magna-aliquyam-erat-sed-diam-voluptua-at-vero-eos-et-accusam-et-justo-duo-dolores-et-ea-rebum-stet-clita-kasd-gubergren-no-sea-takimata-sanctus-est-lorem-ipsum-dolor-sit-amet',
-            // Binary data.
-            'xÃâ¡-]ÃÂ¯pÄ±
-oË;ÃÂ¯)0Ã±]Ã 
-fhHÂ¡Ãg+Â£KËH
-Ën*âÃ
-â¡ÃËÃŒQÃÃµ.âulÃâ ËyÃËÃ¯uâ«
-âºÂ¢>kÆâÃŠÃ¬+Â¯âË âE
-Â¬Â±ÃhâUÃ·%>âï¬ï¬â€1
-' => 'xodagger-emacrp%c4%b1-otildecmacr0nafhhiexcleg-poundk%cb%87h-nedaggeritildeuqoo-lozulineyatildeiuintcentgtkfnofsumaei-macrinfin-enotplusmnahudividegtasymp%ef%ac%81%ef%ac%81le1',
-            '-- repeated - characters -- so---extra - - - look-out!' => 'repeated-characters-so-extra-look-out',
-            'NesthÃ€kchen\'s Teenage Years' => 'nesthakchens-teenage-years',
-            'áŒÏÎ±ÏÎœÎµá¿Ï AkharneÃ®s' => '%e1%bc%88chialpharhonuepsilon%e1%bf%96sigmaf-akharneis',
-            'ÐÐœÑÐŸÐœ ÐÐ°Ð²Ð»ÐŸÐ²ÐžÑ Ð§ÐµÑ
-ÐŸÐ²' => '%d0%90%d0%bd%d1%82%d0%be%d0%bd-%d0%9f%d0%b0%d0%b2%d0%bb%d0%be%d0%b2%d0%b8%d1%87-%d0%a7%d0%b5%d1%85%d0%be%d0%b2',
-            'Demain dÃšs l\'aube' => 'demain-des-laube',
-            'Demain dÃšs lâaube' => 'demain-des-laube',
-        ];
-        foreach ($strings as $input => $expected) {
-            // printf("%s\n", URLSlug($input));
-            $result = URLSlug($input);
-            $this->assertEquals($expected, $result, sprintf('Failed with input: %s', $input));
-        }
-    }
 }
+// Running the test.
+$suite = new PHPUnit_TestSuite('UtilitiesTest');
+$result = PHPUnit::run($suite);
+echo $result->toString();
+?>
Index: trunk/tests/VersionTest.php
===================================================================
--- trunk/tests/VersionTest.php	(revision 815)
+++ 	(revision )
@@ -1,186 +1,0 @@
-<?php
-/**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- *
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * PHPUnit test case for codebase/lib/Version.inc.php
- *
- * The method skeletons below need to be filled in with
- * real data so that the tests will run correctly. Replace
- * all EXPECTED_VAL and PARAM strings with real data.
- *
- * Created with PHPUnit_Skeleton on 2005-08-09
- */
-
-class VersionTest extends PHPUnit_Framework_TestCase {
-
-    var $Version;
-    var $Auth_SQL;
-
-    function setUp()
-    {
-        require dirname(__FILE__) . '/_config.inc.php';
-        require_once '../lib/Version.inc.php';
-
-        require_once '../lib/Auth_SQL.inc.php';
-        $this->Auth_SQL = new Auth_SQL('testauth');
-        $this->Auth_SQL->setParam(array(
-            'db_table'          => 'test_user_tbl',
-            'db_primary_key'    => 'user_id',
-            'db_login_table'    => 'test_login_tbl',
-            'login_url'         => '/login.php',
-            'blocking'          => true
-        ));
-
-        // Use fresh user table.
-        $this->Auth_SQL->initDB(true);
-
-        // Insert test data.
-        $db =& DB::getInstance();
-        $db->query("
-            INSERT INTO test_user_tbl (
-                username,
-                userpass,
-                first_name,
-                last_name,
-                email
-            ) VALUES (
-                'testuser',
-                md5('testpass'),
-                'John',
-                'Doe',
-                'john@example.com'
-            )
-        ");
-
-        $this->Auth_SQL->login('testuser', 'testpass');
-
-        $this->Version =& Version::getInstance($this->Auth_SQL);
-        $this->Version->setParam(array('db_table' => 'test_version_tbl'));
-
-        // Use fresh version table.
-        $this->Version->initDB(true);
-    }
-
-    function tearDown()
-    {
-        $db =& DB::getInstance();
-
-        unset($this->Version);
-        unset($this->Auth_SQL);
-        $db->query("DROP TABLE IF EXISTS test_user_tbl");
-        $db->query("DROP TABLE IF EXISTS test_login_tbl");
-        $db->query("DROP TABLE IF EXISTS test_version_tbl");
-    }
-
-    function test_getinstance()
-    {
-        $result = Version::getinstance($this->Auth_SQL);
-        $this->assertTrue($result && $result instanceof Version);
-    }
-
-    function test_setparam()
-    {
-        $this->Version->setparam(array('var'=>'val'));
-    }
-
-    function test_getparam()
-    {
-        $this->Version->getparam('var');
-    }
-
-    function test_create()
-    {
-        $result = $this->Version->create('test_user_tbl', 'user_id', '1', 'Test User', 'First version of user');
-        $this->assertSame('1', $result);
-    }
-
-    function test_restore()
-    {
-        $current = $this->Version->getCurrent('test_user_tbl', 'user_id', '1');
-        $version_id = $this->Version->create('test_user_tbl', 'user_id', '1', 'Test User', 'First version of user');
-        $versioned = $this->Version->getData($version_id);
-        $result = $this->Version->restore($version_id);
-        $restored = $this->Version->getCurrent('test_user_tbl', 'user_id', '1');
-        $this->assertTrue(is_array($result), 'Restore did not return array.');
-        $this->assertTrue($current === $versioned && $versioned === $restored, 'Restored version does not match original.');
-    }
-
-    function test_deleteold()
-    {
-        // Creat 3 test versions.
-        $this->Version->create('test_user_tbl', 'user_id', '1', 'Test 1', '1 version of user');
-        $this->Version->create('test_user_tbl', 'user_id', '1', 'Test 2', '2 version of user');
-        $this->Version->create('test_user_tbl', 'user_id', '1', 'Test 3', '3 version of user');
-
-        $a = $this->Version->getList('test_user_tbl', 'user_id', '1');
-
-        $this->Version->deleteold('test_user_tbl', 'user_id', '1');
-        $b = $this->Version->getList('test_user_tbl', 'user_id', '1');
-
-        $this->Version->setparam(array('max_qty'=>2));
-        $this->Version->setparam(array('min_qty'=>1));
-        $this->Version->setparam(array('min_days'=>0));
-        $this->Version->deleteold('test_user_tbl', 'user_id', '1');
-        $c = $this->Version->getList('test_user_tbl', 'user_id', '1');
-
-        $this->Version->setparam(array('max_qty'=>0));
-        $this->Version->setparam(array('min_qty'=>0));
-        $this->Version->setparam(array('min_days'=>0));
-        $this->Version->deleteold('test_user_tbl', 'user_id', '1');
-        $d = $this->Version->getList('test_user_tbl', 'user_id', '1');
-
-        $this->assertTrue(sizeof($a) == 3, 'A is wrong');
-        $this->assertTrue(sizeof($b) == 3, 'B is wrong');
-        $this->assertTrue(sizeof($c) == 1, 'C is wrong');
-        $this->assertTrue(sizeof($d) == 0, 'D is wrong');
-    }
-
-    function test_getlist()
-    {
-        $this->Version->create('test_user_tbl', 'user_id', '1', 'Test 1', '1 version of user');
-        $this->Version->create('test_user_tbl', 'user_id', '1', 'Test 2', '2 version of user');
-        $this->Version->create('test_user_tbl', 'user_id', '1', 'Test 3', '3 version of user');
-        $result = $this->Version->getList('test_user_tbl', 'user_id', '1');
-        $this->assertTrue(is_array($result) && !empty($result));
-    }
-
-    function test_getverson()
-    {
-        $version_id = $this->Version->create('test_user_tbl', 'user_id', '1', 'Test User', 'First version of user');
-        $result = $this->Version->getverson($version_id);
-        $this->assertTrue(is_array($result) && !empty($result));
-    }
-
-    function test_getdata()
-    {
-        $version_id = $this->Version->create('test_user_tbl', 'user_id', '1', 'Test User', 'First version of user');
-        $result = $this->Version->getdata($version_id);
-        $this->assertTrue(is_array($result) && !empty($result));
-    }
-
-    function test_getcurrent()
-    {
-        $result = $this->Version->getCurrent('test_user_tbl', 'user_id', '1');
-        $this->assertTrue(is_array($result) && !empty($result));
-    }
-
-}
Index: trunk/tests/_config.inc.php
===================================================================
--- trunk/tests/_config.inc.php	(revision 815)
+++ trunk/tests/_config.inc.php	(revision 1)
@@ -1,34 +1,5 @@
 <?php
-/**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- *
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- *
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
-* Configuration for unit tests.
-*
-* @author   Quinn Comendant <quinn@strangecode.com>
-* @version  1.0
-*/
 require_once '../lib/App.inc.php';
-require_once '../lib/DB.inc.php';
-
-$app =& App::getInstance('testapp');
+$app =& App::getinstance('testapp');
 
 $app->setParam(array(
@@ -45,8 +16,8 @@
     'db_debug' => true,
     'db_die_on_failure' => true,
-    'db_server' => getenv('DB_SERVER'),
-    'db_name' => getenv('DB_NAME'),
-    'db_user' => getenv('DB_USER'),
-    'db_pass' => getenv('DB_PASS'),
+    'db_server' => 'localhost',
+    'db_name' => 'test',
+    'db_user' => 'root',
+    'db_pass' => 'haakm3',        
     'display_errors' => true,
     'db_always_debug' => false, // TRUE = display all SQL queries.
@@ -56,7 +27,9 @@
     'log_filename' => 'codebase_test_log',
     'log_file_priority' => LOG_DEBUG,
-    'log_screen_priority' => LOG_WARNING,
+    'log_screen_priority' => LOG_INFO,
     'error_reporting' => E_ALL,
 ));
 
 $app->start();
+
+?>
Index: trunk/tests/_email_test_addresses.txt
===================================================================
--- trunk/tests/_email_test_addresses.txt	(revision 815)
+++ 	(revision )
@@ -1,90 +1,0 @@
- asdf@domain.com
-Bob Smith asdf@domain.com
-Bob Smith <asdf@domain.com>
-"Bob Smith" asdf@domain.com
-"Bob Smith"a sldkf &D*&F^*&^# @#*$ @#* asdf@domain.com
- "white space" <asdf@domain.com>
- whitespace@domain.com
-asdf@domain.com (hello donkey)
-<asdf@domain.com>
-asdf@domain.com
-asdf@domain4.com
-asdf@[011.0.0.100]
-asdf@[1.0.0.0]
-asdf&asdf@domain.com
-Fred\ Bloggs@example.com
-Joe.\\Blow@example.com
-user+mailbox@example.com
-customer/department=shipping@example.com
-$A12345@example.com
-!def!xyz%abc@example.com
-_somename@example.com
-cthornhill_94%1@yahoo.com
-    "bob!#$%&'*+-/=?^_`.{|}~rice@domain.com",
-mÃŒllÃ©r@domain.com
-sarah.adams.2008@femba.ucla.edu
-dig@whap.heck.suddenly.willy.sam.digity.okay.com.org
-kathryn.p.o\'fee@gsk.com
-stephen.j.o\'quinn@gsk.com
-Wallace.v.cunneen@gsk.com
-myrada.a.carpenter@gsk.com
-caro=los.mccumber@tap.com
-$%^%JidO_kdoe*&&2@lkd.vfg
-asdf@[011.00.100]
-asdf@[011.1234.0.100]
-asdf@[011.0.234.0.100]
-asdf@011.0.0.100]
-asdf@[011.0.0.100
-asdf@011.0.0.100
-asdf@domain4.co-mm
-asdf@4domain.com
-asdf@-domain.com
-asdf@dom_ain.com
-asdf@domain-.com
-asdf@-.com
-asdf@asdf--asdf.com
-asdf@asdfas.asdf--asdf.asdfs.com
-myrada.a.carpenter@g.sk..com
-< asdf@domain.com>
-<asdf@domain.com >
-Mr. Asdf < asdf@domain.com>
-Mr. Asdf <asdf@domain.com >
-asdf@domain.com>
-<asdf@domain.com
-asdf@domain.com (hello donkey
-"Abc@def"@example.com
-"Fred Bloggs"@example.com
-Abc\@def@example.com
-myrada.a.carpenter@gsk.museums
-"asdf"@domain.com
-asdf[asdf@asdf.com
-asdf\'"+)*#%@^!asdf@asdf.com
-Barbara.gonzalez@
-bnutt-spectrumsales.net
-catherine.algra.2008.anderson.ucla.edu
-cheryl.a.mcguirk
-david.zipse@cgu,edu
-davidzipse@cgu,edu
-deanna.t.lapierre@@wellsfargo.com
-freda@freda\'s.com
-get1@pge,com
-john.lamb.ngc.com
-jslinger@saturnoftroy
-kellywatts@saturnof
-kent.plummer@Solvay
-lakshmi.thirumalai.2007@anderson.
-nraymon@hoaghospital
-.bob@domain.com
-bobrice..@domain.com
-bob..rice@domain.com
-usernameistoolongusernameistoolongusernameistoolongusernameistoolongusernameis@domain.com
-domainistoolong@domainistoolong.domainistoolong.domainistoolong.domainistoolong.domainistoolong.domainistoolong.domainistoolong.domainistoolong.domainistoolong.domainistoolong.domainistoolong.domainistoolong.domainistoolong.domainistoolong.domainistoolong.domainistoolong.domainistoolong.domainistoolong.com
-<ken@mail.mpundzu.com>
-<lisah@specialtycare4women.com>
-<jknolle@learningchange.com>
-<cd@monstro.com>
-<spoofing@monstro.com>
-lanebecker@gmail.com
-<fabio@monstro.com>
-neville@dynamiccity.org
-<mtbcsc-spamsubmit@jayallen.org>
Index: trunk/tests/_skel.php
===================================================================
--- trunk/tests/_skel.php	(revision 815)
+++ 	(revision )
@@ -1,79 +1,0 @@
-#!/usr/bin/env php
-<?php
-/**
- * The Strangecode Codebase - a general application development framework for PHP
- * For details visit the project site: <http://trac.strangecode.com/codebase/>
- * Copyright 2001-2012 Strangecode, LLC
- * 
- * This file is part of The Strangecode Codebase.
- *
- * The Strangecode Codebase is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your option)
- * any later version.
- * 
- * The Strangecode Codebase is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
-* Creates new test case file from specified class file.
-*
-* @access  public
-* @param   Only argument is path to file containing class.
-* @author  Quinn Comendant <quinn@strangecode.com>
-* @since   01 Dec 2005 13:56:09
-*/
-require_once 'PHPUnit/Skeleton.php';
-
-$dir = dirname(__FILE__) . '/../lib';
-
-if ($_SERVER['argc'] == 2 && file_exists($dir . '/' . $_SERVER['argv'][1])) {
-    $file = $_SERVER['argv'][1];
-    echo 'Proccessing ' . realpath($dir . '/' . $file) . "\n";
-} else {
-    die('First argument or file not found: ' . $_SERVER['argv'][1] . "\n");
-}
-
-preg_match('/([^\.]+)\..*$/i', $file, $match);
-$classname = $match[1];
-
-$ps = new PHPUnit_Skeleton($classname, '../lib/' . $file);
-
-// Generate the test class.
-// Default settings will not include any parent class methods, but
-// will include private methods.
-$ps->createTestClass();
-
-// Write the new test class to file.
-// By default, code to run the test will be included.
-$ps->writeTestClass();
-
-
-// $dir_handle = opendir($dir);
-// while ($dir_handle && ($file = readdir($dir_handle)) !== false) {
-//     if (!preg_match('/^\./', $file) && is_file($dir . '/' . $file)) {
-//         echo 'Proccessing ' . realpath($dir . '/' . $file) . "\n";
-//
-//         preg_match('/([^\.]+)\..*$/i', $file, $match);
-//         $classname = $match[1];
-//
-//         $ps = new PHPUnit_Skeleton($classname, '../lib/' . $file);
-//
-//         // Generate the test class.
-//         // Default settings will not include any parent class methods, but
-//         // will include private methods.
-//         $ps->createTestClass();
-//
-//         // Write the new test class to file.
-//         // By default, code to run the test will be included.
-//         $ps->writeTestClass();
-//
-//     }
-// }
-
Index: trunk/tests/bootstrap.php
===================================================================
--- trunk/tests/bootstrap.php	(revision 815)
+++ 	(revision )
@@ -1,5 +1,0 @@
-<?php
-// session_start();
-// //set_include_path(get_include_path() . PATH_SEPARATOR . '../..');
-// ini_set('include_path',get_include_path().PATH_SEPARATOR.'/opt'.PATH_SEPARATOR.'..');
-// //die(get_include_path());
Index: trunk/tests/phpunit.xml
===================================================================
--- trunk/tests/phpunit.xml	(revision 815)
+++ 	(revision )
@@ -1,45 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/5.7/phpunit.xsd"
-backupGlobals="false"
-beStrictAboutCoversAnnotation="true"
-beStrictAboutOutputDuringTests="true"
-beStrictAboutTestsThatDoNotTestAnything="true"
-beStrictAboutTodoAnnotatedTests="true"
-convertErrorsToExceptions="false"
-convertNoticesToExceptions="false"
-convertWarningsToExceptions="false"
-bootstrap="bootstrap.php"
-strict="true"
-colors="true"
-verbose="true"
-debug="false"
-tap="true"
-stopOnError="true"
-stopOnFailure="true"
-stopOnIncomplete="true"
-stopOnSkipped="true"
->
-    <includePath>.</includePath>
-    <includePath>/opt</includePath>
-    <testsuite>
-        <file>AppTest.php</file>
-        <file>AuthFileTest.php</file>
-        <!-- <file>AuthorizeNetTest.php</file> -->
-        <file>AuthSQLTest.php</file>
-        <file>CSSTest.php</file>
-        <file>DBSessionHandlerTest.php</file>
-        <file>EmailTest.php</file>
-        <file>FormValidatorTest.php</file>
-        <file>LockTest.php</file>
-        <file>PayPalTest.php</file>
-        <file>VersionTest.php</file>
-        <file>UtilitiesTest.php</file>
-    </testsuite>
-
-    <filter>
-        <whitelist processUncoveredFilesFromWhitelist="true">
-            <directory suffix=".php">src</directory>
-        </whitelist>
-    </filter>
-</phpunit>
Index: trunk/tests/run_tests.sh
===================================================================
--- trunk/tests/run_tests.sh	(revision 815)
+++ trunk/tests/run_tests.sh	(revision 1)
@@ -1,44 +1,5 @@
-#!/bin/bash
-
-# This script sets-up the test environment and runs all tests.
-# You'll want to define your local mysql credentials for a test
-# database as environment variables, e.g., in ~/.bash_profile:
-#  export DB_NAME="test"
-#  export DB_USER="test"
-#  export DB_PASS="..."
-
-# Run an individual test like this:
-# ./tests/run_tests.sh /Users/q/src/codebase/trunk/tests/UtilitiesTest.php
-
-function err {
-    MSG="$1";
-    IFS='';
-    echo -e $MSG 1>&2
-    exit 1;
-}
-
-# Be in the directory with all the tests.
-cd `dirname $0`;
-
-# Get required ENV variables.
-if [[ -z "$DB_USER$DB_PASS$DB_NAME" ]]; then
-    echo "MySQL test DB credential environment variables are missing.\nSet these in ~/.bash_profile to avoid seeing these prompts each time.";
-fi
-for E in DB_SERVER DB_NAME DB_USER DB_PASS; do
-    while [[ -z ${!E} ]]; do
-        read -p "$E: " $E;
-    done
-    export $E;
-done
-
-# Create database.
-mysql -e "CREATE DATABASE IF NOT EXISTS \`${DB_NAME}\`" || err "Failed to create database '${DB_NAME}";
-
-# Go!
-echo "Running the tests!";
-echo "You'll want to 'tail -f /tmp/codebase_test_log' and watch for errors.";
-
-# Config options go in phpunit.xml
-# phpunit --tap | grep -v '^ok '
-../vendor/phpunit/phpunit/composer/bin/phpunit --stderr "$@" || err "\nSomething went wrong (code $?). If there is no output above, check the php_error_log";
-
+#!/bin/sh
+for foo in `dirname $0`/*Test.php; 
+do
+    php $foo;
+done;
Index: trunk/tests/skel.php
===================================================================
--- trunk/tests/skel.php	(revision 1)
+++ trunk/tests/skel.php	(revision 1)
@@ -0,0 +1,28 @@
+<?php
+require_once 'PHPUnit/Skeleton.php';
+
+$dir = dirname(__FILE__) . '/../lib';
+
+$dir_handle = opendir($dir);
+while ($dir_handle && ($file = readdir($dir_handle)) !== false) {
+    if (!preg_match('/^\./', $file) && is_file($dir . '/' . $file)) {
+        echo 'Proccessing ' . realpath($dir . '/' . $file) . "\n";
+        
+        preg_match('/([^\.]+)\..*$/i', $file, $match);
+        $classname = $match[1];
+
+        $ps = new PHPUnit_Skeleton($classname, '../lib/' . $file);
+        
+        // Generate the test class.
+        // Default settings will not include any parent class methods, but
+        // will include private methods.
+        $ps->createTestClass();
+        
+        // Write the new test class to file.
+        // By default, code to run the test will be included.
+        $ps->writeTestClass();
+
+    }
+}
+
+?>
