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:
2 edited

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 */
Note: See TracChangeset for help on using the changeset viewer.