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