Changeset 468 for trunk/tests


Ignore:
Timestamp:
Feb 20, 2014 3:03:59 AM (10 years ago)
Author:
anonymous
Message:

Completed integrating /branches/eli_branch into /trunk. Changes include:

  • Removed closing ?> from end of files
  • Upgrade old-style contructor methods to use construct() instead.
  • Class properties and methods defined as public, private, static or protected
  • Ensure code runs under E_ALL with only mysql_* deprecated warnings
  • Search for the '@' symbol anywhere it might be used to supress runtime errors, then replace with proper error recovery.
  • Run the php cli -l option to check files for syntax errors.
  • Bring tests up-to-date with latest version and methods of PHPUnit
Location:
trunk
Files:
31 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tests/AppTest.php

    r396 r468  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    3030 * Created with PHPUnit_Skeleton on 2005-08-09
    3131 */
    32 require_once 'PHPUnit.php';
    33 class AppTest extends PHPUnit_TestCase {
     32
     33class AppTest extends PHPUnit_Framework_TestCase {
    3434
    3535    var $App;
    3636
    37     function AppTest($name)
    38     {
    39         $this->PHPUnit_TestCase($name);
    40     }
     37    static $shared_session;
    4138
    4239    function setUp()
     
    4441        require dirname(__FILE__) . '/_config.inc.php';
    4542        $this->App =& $app;
     43        $_SESSION = AppTest::$shared_session;
    4644    }
    4745
     
    4947    {
    5048        unset($this->App);
     49        AppTest::$shared_session = $_SESSION;
    5150    }
    5251
     
    6261            'test_config_value' => 1234
    6362        ));
    64         $this->assertTrue(1234 === $this->App->_params['test_config_value']);
     63        $this->assertTrue(1234 === $this->App->getParam('test_config_value'));
    6564    }
    6665
    6766    function test_getParam()
    6867    {
    69         $this->App->_params['test_config_value2'] = 'okay';
     68        //$this->App->setParam('test_config_value2', 'okay');
     69        $this->App->setParam(array(
     70            'test_config_value2' => 'okay'
     71        ));
    7072        $result = $this->App->getParam('test_config_value2');
    7173        $this->assertEquals('okay', $result);
     
    9395    {
    9496        $db =& DB::getInstance();
    95    
     97
    9698        $qid = $db->query("SELECT 2 + 2");
    9799        list($result) = mysql_fetch_row($qid);
     
    104106        $expected = 'My message';
    105107        $app->raiseMsg($expected, MSG_NOTICE, __FILE__, __LINE__);
    106         $msg = current($_SESSION['_app'][$this->App->_ns]['messages']);
     108        $msg = current($_SESSION['_app']['testapp']['messages']);
    107109        $this->assertEquals($expected, $msg['message']);
    108110    }
     
    111113    {
    112114        ob_start();
     115        $this->test_raisemsg();  //had to add this line for phpunit ver. 3.7 ///
    113116        $app =& App::getInstance();
    114117        $app->printraisedmessages();
     
    205208}
    206209// Running the test.
     210/*
    207211$suite = new PHPUnit_TestSuite('AppTest');
    208212$result = PHPUnit::run($suite);
    209213echo $result->toString();
    210 ?>
     214 */
  • trunk/tests/Auth_FileTest.php

    r396 r468  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    120120$result = PHPUnit::run($suite);
    121121echo $result->toString();
    122 ?>
  • trunk/tests/Auth_SQLTest.php

    r457 r468  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    3030 * Created with PHPUnit_Skeleton on 2005-08-09
    3131 */
    32 require_once 'PHPUnit.php';
     32
    3333class Auth_SQLTest extends PHPUnit_TestCase {
    3434
     
    5151            'login_url'         => '/login.php',
    5252            'blocking'          => true,
    53             'encryption_type' => AUTH_ENCRYPT_MD5_HARDENED,
     53            'encryption_type' => Auth_SQL::ENCRYPT_MD5_HARDENED,
    5454        ));
    5555
     
    8080    {
    8181        $db =& DB::getInstance();
    82    
     82
    8383        unset($this->Auth_SQL);
    8484        $db->query("DROP TABLE IF EXISTS test_user_tbl");
     
    145145        $after_logged_in = $this->Auth_SQL->isloggedin();
    146146        $this->assertFalse($after_logged_in, '3. User is still logged in but should not be.');
    147        
     147
    148148        // Testing wrong password.
    149149        $login2 = $this->Auth_SQL->login('testuser', 'wrongpass');
     
    164164    {
    165165        $db =& DB::getInstance();
    166    
     166
    167167        $this->Auth_SQL->login('testuser', 'testpass');
    168168        $this->Auth_SQL->blockaccount(null, 'blocktestuser');
     
    178178    {
    179179        $db =& DB::getInstance();
    180    
     180
    181181        $db->query("
    182182            UPDATE test_user_tbl SET blocked_reason = 'blocktestuser'
     
    212212    function test_encryptpassword()
    213213    {
    214         $this->Auth_SQL->setParam(array('encryption_type' => AUTH_ENCRYPT_MD5));
     214        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_MD5));
    215215        $result = $this->Auth_SQL->encryptpassword('123');
    216216        $this->assertEquals('202cb962ac59075b964b07152d234b70', $result);
    217217
    218         $this->Auth_SQL->setParam(array('encryption_type' => AUTH_ENCRYPT_MD5_HARDENED));
     218        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_MD5_HARDENED));
    219219        $result = $this->Auth_SQL->encryptpassword('123');
    220220        $this->assertEquals('c55e4ac608a8768ecd758fab971b0646', $result);
    221221
    222         $this->Auth_SQL->setParam(array('encryption_type' => AUTH_ENCRYPT_SHA1));
     222        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_SHA1));
    223223        $result = $this->Auth_SQL->encryptpassword('123');
    224224        $this->assertEquals('40bd001563085fc35165329ea1ff5c5ecbdbbeef', $result);
    225225
    226         $this->Auth_SQL->setParam(array('encryption_type' => AUTH_ENCRYPT_SHA1_HARDENED));
     226        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_SHA1_HARDENED));
    227227        $result = $this->Auth_SQL->encryptpassword('123');
    228228        $this->assertEquals('33d90af96a5928ac93cbd41fc436e8c55d2768c2', $result);
    229229
    230         $this->Auth_SQL->setParam(array('encryption_type' => AUTH_ENCRYPT_PLAINTEXT));
     230        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_PLAINTEXT));
    231231        $result = $this->Auth_SQL->encryptpassword('123');
    232232        $this->assertEquals('123', $result);
    233233
    234         $this->Auth_SQL->setParam(array('encryption_type' => AUTH_ENCRYPT_CRYPT));
     234        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_CRYPT));
    235235        $result = $this->Auth_SQL->encryptpassword('123', 'saltstring');
    236236        $this->assertEquals('saEZ6MlWYV9nQ', $result);
     
    240240    {
    241241        $db =& DB::getInstance();
    242    
    243         $this->Auth_SQL->setParam(array('encryption_type' => AUTH_ENCRYPT_SHA1_HARDENED));
     242
     243        $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_SHA1_HARDENED));
    244244        $this->Auth_SQL->setpassword(null, '123');
    245245        $qid = $db->query("
     
    261261$result = PHPUnit::run($suite);
    262262echo $result->toString();
    263 ?>
  • trunk/tests/AuthorizeNetTest.php

    r396 r468  
    3030 * Created with PHPUnit_Skeleton on 2005-08-09
    3131 */
    32 require_once 'PHPUnit.php';
    33 class AuthorizeNetTest extends PHPUnit_TestCase {
     32
     33class AuthorizeNetTest extends PHPUnit_Framework_TestCase {
    3434
    3535    var $AuthorizeNet;
    36 
    37     function AuthorizeNetTest($name)
    38     {
    39         $this->PHPUnit_TestCase($name);
    40     }
    41 
     36   
     37    static $shared_session;
     38   
    4239    function setUp()
    4340    {
     
    4542        require_once '../lib/AuthorizeNet.inc.php';
    4643
    47         $this->AuthorizeNet =& new AuthorizeNet();
     44        $this->AuthorizeNet = new AuthorizeNet();
    4845        $this->AuthorizeNet->setParam(array(
    4946            'x_login' => 'myaccount',
     
    6158            'x_zip' => '75010',
    6259        ));
     60        $_SESSION = AuthorizeNetTest::$shared_session;
    6361    }
    6462
     
    6664    {
    6765        unset($this->AuthorizeNet);
     66        AuthorizeNetTest::$shared_session = $_SESSION;
    6867    }
    6968
     
    7170    {
    7271        $this->AuthorizeNet->setparam(array('x_Login' => 'myaccount2'));
    73         $this->assertEquals('myaccount2', $this->AuthorizeNet->_params['x_Login']);
     72        $this->assertEquals('myaccount2', $this->AuthorizeNet->getParam('x_Login'));
    7473    }
    7574
     
    119118
    120119}
    121 // Running the test.
    122 $suite = new PHPUnit_TestSuite('AuthorizeNetTest');
    123 $result = PHPUnit::run($suite);
    124 echo $result->toString();
    125 ?>
  • trunk/tests/CSSTest.php

    r396 r468  
    3030 * Created with PHPUnit_Skeleton on 2005-08-09
    3131 */
    32 require_once 'PHPUnit.php';
    33 class CSSTest extends PHPUnit_TestCase {
     32
     33class CSSTest extends PHPUnit_Framework_TestCase {
    3434
    3535    var $CSS;
    3636    var $test_css_file;
    37 
    38     function CSSTest($name)
    39     {
    40         $this->PHPUnit_TestCase($name);
    41     }
    4237
    4338    function setUp()
     
    4641        $this->test_css_file = dirname(__FILE__) . '/../css/codebase.inc.css';
    4742        require_once '../lib/CSS.inc.php';
    48         $this->CSS =& new CSS();
     43        $this->CSS = new CSS();
    4944        $this->CSS->setFile($this->test_css_file);
    5045    }
     
    8681
    8782}
    88 // Running the test.
    89 $suite = new PHPUnit_TestSuite('CSSTest');
    90 $result = PHPUnit::run($suite);
    91 echo $result->toString();
    92 ?>
  • trunk/tests/CacheTest.php

    r396 r468  
    77 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    88 * Copyright 2001-2012 Strangecode, LLC
    9  * 
     9 *
    1010 * This file is part of The Strangecode Codebase.
    1111 *
     
    1414 * Free Software Foundation, either version 3 of the License, or (at your option)
    1515 * any later version.
    16  * 
     16 *
    1717 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1818 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1919 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    2020 * details.
    21  * 
     21 *
    2222 * You should have received a copy of the GNU General Public License along with
    2323 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class CacheTest extends PHPUnit_TestCase {
     35
     36class CacheTest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $Cache;
     
    4040    function CacheTest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    105105
    106106}
    107 // Running the test.
    108 $suite = new PHPUnit_TestSuite('CacheTest');
    109 $result = PHPUnit::run($suite);
    110 echo $result->toString();
    111 ?>
  • trunk/tests/DBSessionHandlerTest.php

    r396 r468  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    3030 * Created with PHPUnit_Skeleton on 2005-08-09
    3131 */
    32 require_once 'PHPUnit.php';
    33 class DBSessionHandlerTest extends PHPUnit_TestCase {
     32
     33class DBSessionHandlerTest extends PHPUnit_Framework_TestCase {
    3434
    3535    var $DBSessionHandler;
    36 
    37     function DBSessionHandlerTest($name)
    38     {
    39         $this->PHPUnit_TestCase($name);
    40     }
    4136
    4237    function setUp()
     
    7368    function test_DBsessionwrite()
    7469    {
     70        if (!isset($_SESSION)) {
     71            $_SESSION = array();
     72        }
    7573        $this->DBSessionHandler->DBsessionwrite(session_id(), serialize($_SESSION));
    7674    }
     
    8785
    8886}
    89 // Running the test.
    90 $suite = new PHPUnit_TestSuite('DBSessionHandlerTest');
    91 $result = PHPUnit::run($suite);
    92 echo $result->toString();
    93 ?>
  • trunk/tests/EmailTest.php

    r399 r468  
    11<?php
     2
    23/**
    34 * The Strangecode Codebase - a general application development framework for PHP
     
    3031 * Created with PHPUnit_Skeleton on 2005-12-01
    3132 */
    32 require_once 'PHPUnit.php';
    33 class EmailTest extends PHPUnit_TestCase {
     33
     34class EmailTest extends PHPUnit_Framework_TestCase {
    3435
    3536    var $Email;
    36 
    37     function EmailTest($name)
    38     {
    39         $this->PHPUnit_TestCase($name);
    40     }
    4137
    4238    function setUp()
     
    4440        require dirname(__FILE__) . '/_config.inc.php';
    4541        require_once '../lib/Email.inc.php';
    46         $this->Email =& new Email();
     42        $this->Email = new Email();
    4743    }
    4844
     
    122118
    123119}
    124 // Running the test.
    125 $suite  = new PHPUnit_TestSuite('EmailTest');
    126 $result = PHPUnit::run($suite);
    127 echo $result->toString();
    128 ?>
  • trunk/tests/FormValidatorTest.php

    r396 r468  
    3030 * Created with PHPUnit_Skeleton on 2005-08-09
    3131 */
    32 require_once 'PHPUnit.php';
    33 class FormValidatorTest extends PHPUnit_TestCase {
     32
     33class FormValidatorTest extends PHPUnit_Framework_TestCase {
    3434
    3535    var $FormValidator;
    36 
    37     function FormValidatorTest($name)
    38     {
    39         $this->PHPUnit_TestCase($name);
    40     }
    4136
    4237    function setUp()
     
    4439        require dirname(__FILE__) . '/_config.inc.php';
    4540        require_once '../lib/FormValidator.inc.php';
    46         $this->FormValidator =& new FormValidator();
     41        $this->FormValidator = new FormValidator();
    4742    }
    4843
     
    294289
    295290}
    296 // Running the test.
    297 $suite = new PHPUnit_TestSuite('FormValidatorTest');
    298 $result = PHPUnit::run($suite);
    299 echo $result->toString();
    300 ?>
  • trunk/tests/Google_APITest.php

    r396 r468  
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class GoogleAPITest extends PHPUnit_TestCase {
     35
     36class GoogleAPITest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $GoogleAPI;
     
    4040    function GoogleAPITest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    9191
    9292}
    93 // Running the test.
    94 $suite = new PHPUnit_TestSuite('GoogleAPITest');
    95 $result = PHPUnit::run($suite);
    96 echo $result->toString();
    97 ?>
  • trunk/tests/HierarchyTest.php

    r396 r468  
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class HierarchyTest extends PHPUnit_TestCase {
     35
     36class HierarchyTest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $Hierarchy;
     
    4040    function HierarchyTest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    175175
    176176}
    177 // Running the test.
    178 $suite = new PHPUnit_TestSuite('HierarchyTest');
    179 $result = PHPUnit::run($suite);
    180 echo $result->toString();
    181 ?>
  • trunk/tests/ImageThumbTest.php

    r396 r468  
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class ImageThumbTest extends PHPUnit_TestCase {
     35
     36class ImageThumbTest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $ImageThumb;
     
    4040    function ImageThumbTest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    119119
    120120}
    121 // Running the test.
    122 $suite = new PHPUnit_TestSuite('ImageThumbTest');
    123 $result = PHPUnit::run($suite);
    124 echo $result->toString();
    125 ?>
  • trunk/tests/LockTest.php

    r396 r468  
    3030 * Created with PHPUnit_Skeleton on 2005-08-09
    3131 */
    32 require_once 'PHPUnit.php';
    33 class LockTest extends PHPUnit_TestCase {
     32
     33class LockTest extends PHPUnit_Framework_TestCase {
    3434
    3535    var $Lock;
    3636    var $Auth_SQL;
    37 
    38     function LockTest($name)
    39     {
    40         $this->PHPUnit_TestCase($name);
    41     }
    4237
    4338    function setUp()
     
    4742        require_once '../lib/Auth_SQL.inc.php';
    4843
    49         $this->Auth_SQL =& new Auth_SQL('test');
     44        $this->Auth_SQL = new Auth_SQL('test');
    5045        $this->Auth_SQL->setParam(array(
    5146            'db_table'          => 'test_user_tbl',
     
    208203    {
    209204        $result = $this->Lock->getsecondselapsed();
    210         $this->assertType('integer', $result);
     205        $this->assertInternalType('integer', $result);
    211206    }
    212207
    213208}
    214 // Running the test.
    215 $suite = new PHPUnit_TestSuite('LockTest');
    216 $result = PHPUnit::run($suite);
    217 echo $result->toString();
    218 ?>
  • trunk/tests/MCVETest.php

    r396 r468  
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class MCVETest extends PHPUnit_TestCase {
     35
     36class MCVETest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $MCVE;
     
    4040    function MCVETest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    9191
    9292}
    93 // Running the test.
    94 $suite = new PHPUnit_TestSuite('MCVETest');
    95 $result = PHPUnit::run($suite);
    96 echo $result->toString();
    97 ?>
  • trunk/tests/NavTest.php

    r396 r468  
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class NavigationTest extends PHPUnit_TestCase {
     35
     36class NavigationTest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $Navigation;
     
    4040    function NavigationTest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    133133
    134134}
    135 // Running the test.
    136 $suite = new PHPUnit_TestSuite('NavigationTest');
    137 $result = PHPUnit::run($suite);
    138 echo $result->toString();
    139 ?>
  • trunk/tests/PEditTest.php

    r396 r468  
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class PEditTest extends PHPUnit_TestCase {
     35
     36class PEditTest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $PEdit;
     
    4040    function PEditTest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    154154
    155155}
    156 // Running the test.
    157 $suite = new PHPUnit_TestSuite('PEditTest');
    158 $result = PHPUnit::run($suite);
    159 echo $result->toString();
    160 ?>
  • trunk/tests/PageNumbersTest.php

    r396 r468  
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class PageNumbersTest extends PHPUnit_TestCase {
     35
     36class PageNumbersTest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $PageNumbers;
     
    4040    function PageNumbersTest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    133133
    134134}
    135 // Running the test.
    136 $suite = new PHPUnit_TestSuite('PageNumbersTest');
    137 $result = PHPUnit::run($suite);
    138 echo $result->toString();
    139 ?>
  • trunk/tests/PageSequenceTest.php

    r396 r468  
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class PageSequenceTest extends PHPUnit_TestCase {
     35
     36class PageSequenceTest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $PageSequence;
     
    4040    function PageSequenceTest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    182182
    183183}
    184 // Running the test.
    185 $suite = new PHPUnit_TestSuite('PageSequenceTest');
    186 $result = PHPUnit::run($suite);
    187 echo $result->toString();
    188 ?>
  • trunk/tests/PayPalTest.php

    r396 r468  
    3030 * Created with PHPUnit_Skeleton on 2005-08-09
    3131 */
    32 require_once 'PHPUnit.php';
    33 class PayPalTest extends PHPUnit_TestCase {
     32
     33class PayPalTest extends PHPUnit_Framework_TestCase {
    3434
    3535    var $PayPal;
    36 
    37     function PayPalTest($name)
    38     {
    39         $this->PHPUnit_TestCase($name);
    40     }
    4136
    4237    function setUp()
     
    4439        require dirname(__FILE__) . '/_config.inc.php';
    4540        require_once '../lib/PayPal.inc.php';
    46         $this->PayPal =& new PayPal();
     41        $this->PayPal = new PayPal();
    4742
    4843        // Defaults for purchasing classified postings.
     
    9085        ));
    9186        $result = $this->PayPal->getlink('testitem');
    92         $this->assertTrue(preg_match('/customdata/', $result));
     87        //$this->assertTrue(preg_match('/customdata/', $result));
     88        $this->assertSame(1, preg_match('/customdata/', $result));
    9389    }
    9490
     
    10399        $this->PayPal->printbutton('testitem');
    104100        $result = ob_get_clean();
    105         $this->assertTrue(preg_match('/customdata/', $result));
     101        //$this->assertTrue(preg_match('/customdata/', $result));
     102        $this->assertSame(1, preg_match('/customdata/', $result));
     103       
    106104    }
    107105
     
    134132
    135133}
    136 // Running the test.
    137 $suite = new PHPUnit_TestSuite('PayPalTest');
    138 $result = PHPUnit::run($suite);
    139 echo $result->toString();
    140 ?>
  • trunk/tests/PrefsTest.php

    r396 r468  
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class PrefsTest extends PHPUnit_TestCase {
     35
     36class PrefsTest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $Prefs;
     
    4040    function PrefsTest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    112112
    113113}
    114 // Running the test.
    115 $suite = new PHPUnit_TestSuite('PrefsTest');
    116 $result = PHPUnit::run($suite);
    117 echo $result->toString();
    118 ?>
  • trunk/tests/ScriptTimerTest.php

    r396 r468  
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class ScriptTimerTest extends PHPUnit_TestCase {
     35
     36class ScriptTimerTest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $ScriptTimer;
     
    4040    function ScriptTimerTest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    7777
    7878}
    79 // Running the test.
    80 $suite = new PHPUnit_TestSuite('ScriptTimerTest');
    81 $result = PHPUnit::run($suite);
    82 echo $result->toString();
    83 ?>
  • trunk/tests/SortOrderTest.php

    r396 r468  
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class SortOrderTest extends PHPUnit_TestCase {
     35
     36class SortOrderTest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $SortOrder;
     
    4040    function SortOrderTest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    9191
    9292}
    93 // Running the test.
    94 $suite = new PHPUnit_TestSuite('SortOrderTest');
    95 $result = PHPUnit::run($suite);
    96 echo $result->toString();
    97 ?>
  • trunk/tests/SpellCheckTest.php

    r396 r468  
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class SpellCheckTest extends PHPUnit_TestCase {
     35
     36class SpellCheckTest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $SpellCheck;
     
    4040    function SpellCheckTest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    154154
    155155}
    156 // Running the test.
    157 $suite = new PHPUnit_TestSuite('SpellCheckTest');
    158 $result = PHPUnit::run($suite);
    159 echo $result->toString();
    160 ?>
  • trunk/tests/TemplateGlueTest.php

    r396 r468  
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class TemplateGlueTest extends PHPUnit_TestCase {
     35
     36class TemplateGlueTest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $TemplateGlue;
     
    4040    function TemplateGlueTest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    5656
    5757}
    58 // Running the test.
    59 $suite = new PHPUnit_TestSuite('TemplateGlueTest');
    60 $result = PHPUnit::run($suite);
    61 echo $result->toString();
    62 ?>
  • trunk/tests/UploadTest.php

    r396 r468  
    77 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    88 * Copyright 2001-2012 Strangecode, LLC
    9  * 
     9 *
    1010 * This file is part of The Strangecode Codebase.
    1111 *
     
    1414 * Free Software Foundation, either version 3 of the License, or (at your option)
    1515 * any later version.
    16  * 
     16 *
    1717 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1818 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1919 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    2020 * details.
    21  * 
     21 *
    2222 * You should have received a copy of the GNU General Public License along with
    2323 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class UploadTest extends PHPUnit_TestCase {
     35
     36class UploadTest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $Upload;
     
    4040    function UploadTest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    120120    function test_getfilenameextension()
    121121    {
    122         $result = $this->Upload->getfilenameextension(PARAM);
     122        $result = $this->Upload::getfilenameextension(PARAM);
    123123        $expected = EXPECTED_VAL;
    124124        $this->assertEquals($expected, $result);
     
    126126
    127127}
    128 // Running the test.
    129 $suite = new PHPUnit_TestSuite('UploadTest');
    130 $result = PHPUnit::run($suite);
    131 echo $result->toString();
    132 ?>
  • trunk/tests/UtilitiesTest.php

    r396 r468  
    3333 * Created with PHPUnit_Skeleton on 2005-08-09
    3434 */
    35 require_once 'PHPUnit.php';
    36 class UtilitiesTest extends PHPUnit_TestCase {
     35
     36class UtilitiesTest extends PHPUnit_Framework_TestCase {
    3737
    3838    var $Utilities;
     
    4040    function UtilitiesTest($name)
    4141    {
    42         $this->PHPUnit_TestCase($name);
     42        $this->PHPUnit_Framework_TestCase($name);
    4343    }
    4444
     
    5656
    5757}
    58 // Running the test.
    59 $suite = new PHPUnit_TestSuite('UtilitiesTest');
    60 $result = PHPUnit::run($suite);
    61 echo $result->toString();
    62 ?>
  • trunk/tests/VersionTest.php

    r396 r468  
    3030 * Created with PHPUnit_Skeleton on 2005-08-09
    3131 */
    32 require_once 'PHPUnit.php';
    33 class VersionTest extends PHPUnit_TestCase {
     32
     33class VersionTest extends PHPUnit_Framework_TestCase {
    3434
    3535    var $Version;
    3636    var $Auth_SQL;
    37 
    38     function VersionTest($name)
    39     {
    40         $this->PHPUnit_TestCase($name);
    41     }
    4237
    4338    function setUp()
     
    4742
    4843        require_once '../lib/Auth_SQL.inc.php';
    49         $this->Auth_SQL =& new Auth_SQL('testauth');
     44        $this->Auth_SQL = new Auth_SQL('testauth');
    5045        $this->Auth_SQL->setParam(array(
    5146            'db_table'          => 'test_user_tbl',
     
    116111    {
    117112        $result = $this->Version->create('test_user_tbl', 'user_id', '1', 'Test User', 'First version of user');
    118         $this->assertTrue($result);
     113        $this->assertSame(1, $result);
    119114    }
    120115
     
    190185
    191186}
    192 // Running the test.
    193 $suite = new PHPUnit_TestSuite('VersionTest');
    194 $result = PHPUnit::run($suite);
    195 echo $result->toString();
    196 ?>
  • trunk/tests/_config.inc.php

    r396 r468  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    2828*/
    2929require_once '../lib/App.inc.php';
     30
    3031$app =& App::getInstance('testapp');
    3132
     
    4445    'db_die_on_failure' => true,
    4546    'db_server' => 'localhost',
    46     'db_name' => 'test',
    47     'db_user' => 'root',
     47    'db_name' => getenv('DB_NAME'),
     48    'db_user' => getenv('DB_USER'),
    4849    'db_pass' => getenv('DB_PASS'),
    4950    'display_errors' => true,
     
    5960
    6061$app->start();
    61 ?>
  • trunk/tests/_skel.php

    r412 r468  
    7878// }
    7979
    80 ?>
  • trunk/tests/run_tests.sh

    r399 r468  
    1 #!/bin/sh
     1#!/bin/bash
     2
     3# This script sets-up the test environment and runs all tests.
     4# You'll want to define your local mysql credentials for a test
     5# database as environment variables, e.g., in ~/.bash_profile:
     6#  export DB_NAME="test"
     7#  export DB_USER="test"
     8#  export DB_PASS="..."
    29
    310# Be in the directory with all the tests.
    411cd `dirname $0`;
    512
     13# Get required ENV variables.
     14if [[ -z "$DB_USER$DB_PASS$DB_NAME" ]]; then
     15    echo "MySQL test DB credential environment variables are missing.\nSet these in ~/.bash_profile to avoid seeing these prompts each time.";
     16fi
     17for E in DB_USER DB_PASS DB_NAME; do
     18    while [[ -z ${!E} ]]; do
     19        read -p "$E: " $E;
     20    done
     21    export $E;
     22done
     23
    624# Create database.
    725mysql -e 'CREATE DATABASE IF NOT EXISTS `test`';
    826
    9 # Run tests sequentially.
    10 for foo in *Test.php;
    11 do
    12     php $foo;
    13 done;
     27# Go!
     28echo "Running the tests!";
     29echo "You'll want to 'tail -f /tmp/codebase_test_log' and watch for errors.";
     30
     31# Config options go in phpunit.xml
     32# phpunit --tap | grep -v '^ok '
     33phpunit --stderr
Note: See TracChangeset for help on using the changeset viewer.