Changeset 468 for trunk/tests
- Timestamp:
- Feb 20, 2014 3:03:59 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 31 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:mergeinfo
set to
/branches/eli_branch merged eligible
-
Property
svn:mergeinfo
set to
-
trunk/tests/AppTest.php
r396 r468 4 4 * For details visit the project site: <http://trac.strangecode.com/codebase/> 5 5 * Copyright 2001-2012 Strangecode, LLC 6 * 6 * 7 7 * This file is part of The Strangecode Codebase. 8 8 * … … 11 11 * Free Software Foundation, either version 3 of the License, or (at your option) 12 12 * any later version. 13 * 13 * 14 14 * The Strangecode Codebase is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 17 * details. 18 * 18 * 19 19 * You should have received a copy of the GNU General Public License along with 20 20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 30 30 * Created with PHPUnit_Skeleton on 2005-08-09 31 31 */ 32 require_once 'PHPUnit.php'; 33 class AppTest extends PHPUnit_ TestCase {32 33 class AppTest extends PHPUnit_Framework_TestCase { 34 34 35 35 var $App; 36 36 37 function AppTest($name) 38 { 39 $this->PHPUnit_TestCase($name); 40 } 37 static $shared_session; 41 38 42 39 function setUp() … … 44 41 require dirname(__FILE__) . '/_config.inc.php'; 45 42 $this->App =& $app; 43 $_SESSION = AppTest::$shared_session; 46 44 } 47 45 … … 49 47 { 50 48 unset($this->App); 49 AppTest::$shared_session = $_SESSION; 51 50 } 52 51 … … 62 61 'test_config_value' => 1234 63 62 )); 64 $this->assertTrue(1234 === $this->App-> _params['test_config_value']);63 $this->assertTrue(1234 === $this->App->getParam('test_config_value')); 65 64 } 66 65 67 66 function test_getParam() 68 67 { 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 )); 70 72 $result = $this->App->getParam('test_config_value2'); 71 73 $this->assertEquals('okay', $result); … … 93 95 { 94 96 $db =& DB::getInstance(); 95 97 96 98 $qid = $db->query("SELECT 2 + 2"); 97 99 list($result) = mysql_fetch_row($qid); … … 104 106 $expected = 'My message'; 105 107 $app->raiseMsg($expected, MSG_NOTICE, __FILE__, __LINE__); 106 $msg = current($_SESSION['_app'][ $this->App->_ns]['messages']);108 $msg = current($_SESSION['_app']['testapp']['messages']); 107 109 $this->assertEquals($expected, $msg['message']); 108 110 } … … 111 113 { 112 114 ob_start(); 115 $this->test_raisemsg(); //had to add this line for phpunit ver. 3.7 /// 113 116 $app =& App::getInstance(); 114 117 $app->printraisedmessages(); … … 205 208 } 206 209 // Running the test. 210 /* 207 211 $suite = new PHPUnit_TestSuite('AppTest'); 208 212 $result = PHPUnit::run($suite); 209 213 echo $result->toString(); 210 ?> 214 */ -
trunk/tests/Auth_FileTest.php
r396 r468 4 4 * For details visit the project site: <http://trac.strangecode.com/codebase/> 5 5 * Copyright 2001-2012 Strangecode, LLC 6 * 6 * 7 7 * This file is part of The Strangecode Codebase. 8 8 * … … 11 11 * Free Software Foundation, either version 3 of the License, or (at your option) 12 12 * any later version. 13 * 13 * 14 14 * The Strangecode Codebase is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 17 * details. 18 * 18 * 19 19 * You should have received a copy of the GNU General Public License along with 20 20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 120 120 $result = PHPUnit::run($suite); 121 121 echo $result->toString(); 122 ?> -
trunk/tests/Auth_SQLTest.php
r457 r468 4 4 * For details visit the project site: <http://trac.strangecode.com/codebase/> 5 5 * Copyright 2001-2012 Strangecode, LLC 6 * 6 * 7 7 * This file is part of The Strangecode Codebase. 8 8 * … … 11 11 * Free Software Foundation, either version 3 of the License, or (at your option) 12 12 * any later version. 13 * 13 * 14 14 * The Strangecode Codebase is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 17 * details. 18 * 18 * 19 19 * You should have received a copy of the GNU General Public License along with 20 20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 30 30 * Created with PHPUnit_Skeleton on 2005-08-09 31 31 */ 32 require_once 'PHPUnit.php'; 32 33 33 class Auth_SQLTest extends PHPUnit_TestCase { 34 34 … … 51 51 'login_url' => '/login.php', 52 52 'blocking' => true, 53 'encryption_type' => A UTH_ENCRYPT_MD5_HARDENED,53 'encryption_type' => Auth_SQL::ENCRYPT_MD5_HARDENED, 54 54 )); 55 55 … … 80 80 { 81 81 $db =& DB::getInstance(); 82 82 83 83 unset($this->Auth_SQL); 84 84 $db->query("DROP TABLE IF EXISTS test_user_tbl"); … … 145 145 $after_logged_in = $this->Auth_SQL->isloggedin(); 146 146 $this->assertFalse($after_logged_in, '3. User is still logged in but should not be.'); 147 147 148 148 // Testing wrong password. 149 149 $login2 = $this->Auth_SQL->login('testuser', 'wrongpass'); … … 164 164 { 165 165 $db =& DB::getInstance(); 166 166 167 167 $this->Auth_SQL->login('testuser', 'testpass'); 168 168 $this->Auth_SQL->blockaccount(null, 'blocktestuser'); … … 178 178 { 179 179 $db =& DB::getInstance(); 180 180 181 181 $db->query(" 182 182 UPDATE test_user_tbl SET blocked_reason = 'blocktestuser' … … 212 212 function test_encryptpassword() 213 213 { 214 $this->Auth_SQL->setParam(array('encryption_type' => A UTH_ENCRYPT_MD5));214 $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_MD5)); 215 215 $result = $this->Auth_SQL->encryptpassword('123'); 216 216 $this->assertEquals('202cb962ac59075b964b07152d234b70', $result); 217 217 218 $this->Auth_SQL->setParam(array('encryption_type' => A UTH_ENCRYPT_MD5_HARDENED));218 $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_MD5_HARDENED)); 219 219 $result = $this->Auth_SQL->encryptpassword('123'); 220 220 $this->assertEquals('c55e4ac608a8768ecd758fab971b0646', $result); 221 221 222 $this->Auth_SQL->setParam(array('encryption_type' => A UTH_ENCRYPT_SHA1));222 $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_SHA1)); 223 223 $result = $this->Auth_SQL->encryptpassword('123'); 224 224 $this->assertEquals('40bd001563085fc35165329ea1ff5c5ecbdbbeef', $result); 225 225 226 $this->Auth_SQL->setParam(array('encryption_type' => A UTH_ENCRYPT_SHA1_HARDENED));226 $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_SHA1_HARDENED)); 227 227 $result = $this->Auth_SQL->encryptpassword('123'); 228 228 $this->assertEquals('33d90af96a5928ac93cbd41fc436e8c55d2768c2', $result); 229 229 230 $this->Auth_SQL->setParam(array('encryption_type' => A UTH_ENCRYPT_PLAINTEXT));230 $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_PLAINTEXT)); 231 231 $result = $this->Auth_SQL->encryptpassword('123'); 232 232 $this->assertEquals('123', $result); 233 233 234 $this->Auth_SQL->setParam(array('encryption_type' => A UTH_ENCRYPT_CRYPT));234 $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_CRYPT)); 235 235 $result = $this->Auth_SQL->encryptpassword('123', 'saltstring'); 236 236 $this->assertEquals('saEZ6MlWYV9nQ', $result); … … 240 240 { 241 241 $db =& DB::getInstance(); 242 243 $this->Auth_SQL->setParam(array('encryption_type' => A UTH_ENCRYPT_SHA1_HARDENED));242 243 $this->Auth_SQL->setParam(array('encryption_type' => Auth_SQL::ENCRYPT_SHA1_HARDENED)); 244 244 $this->Auth_SQL->setpassword(null, '123'); 245 245 $qid = $db->query(" … … 261 261 $result = PHPUnit::run($suite); 262 262 echo $result->toString(); 263 ?> -
trunk/tests/AuthorizeNetTest.php
r396 r468 30 30 * Created with PHPUnit_Skeleton on 2005-08-09 31 31 */ 32 require_once 'PHPUnit.php'; 33 class AuthorizeNetTest extends PHPUnit_ TestCase {32 33 class AuthorizeNetTest extends PHPUnit_Framework_TestCase { 34 34 35 35 var $AuthorizeNet; 36 37 function AuthorizeNetTest($name) 38 { 39 $this->PHPUnit_TestCase($name); 40 } 41 36 37 static $shared_session; 38 42 39 function setUp() 43 40 { … … 45 42 require_once '../lib/AuthorizeNet.inc.php'; 46 43 47 $this->AuthorizeNet = &new AuthorizeNet();44 $this->AuthorizeNet = new AuthorizeNet(); 48 45 $this->AuthorizeNet->setParam(array( 49 46 'x_login' => 'myaccount', … … 61 58 'x_zip' => '75010', 62 59 )); 60 $_SESSION = AuthorizeNetTest::$shared_session; 63 61 } 64 62 … … 66 64 { 67 65 unset($this->AuthorizeNet); 66 AuthorizeNetTest::$shared_session = $_SESSION; 68 67 } 69 68 … … 71 70 { 72 71 $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')); 74 73 } 75 74 … … 119 118 120 119 } 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 30 30 * Created with PHPUnit_Skeleton on 2005-08-09 31 31 */ 32 require_once 'PHPUnit.php'; 33 class CSSTest extends PHPUnit_ TestCase {32 33 class CSSTest extends PHPUnit_Framework_TestCase { 34 34 35 35 var $CSS; 36 36 var $test_css_file; 37 38 function CSSTest($name)39 {40 $this->PHPUnit_TestCase($name);41 }42 37 43 38 function setUp() … … 46 41 $this->test_css_file = dirname(__FILE__) . '/../css/codebase.inc.css'; 47 42 require_once '../lib/CSS.inc.php'; 48 $this->CSS = &new CSS();43 $this->CSS = new CSS(); 49 44 $this->CSS->setFile($this->test_css_file); 50 45 } … … 86 81 87 82 } 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 7 7 * For details visit the project site: <http://trac.strangecode.com/codebase/> 8 8 * Copyright 2001-2012 Strangecode, LLC 9 * 9 * 10 10 * This file is part of The Strangecode Codebase. 11 11 * … … 14 14 * Free Software Foundation, either version 3 of the License, or (at your option) 15 15 * any later version. 16 * 16 * 17 17 * The Strangecode Codebase is distributed in the hope that it will be useful, but 18 18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19 19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 20 20 * details. 21 * 21 * 22 22 * You should have received a copy of the GNU General Public License along with 23 23 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class CacheTest extends PHPUnit_ TestCase {35 36 class CacheTest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $Cache; … … 40 40 function CacheTest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 105 105 106 106 } 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 4 4 * For details visit the project site: <http://trac.strangecode.com/codebase/> 5 5 * Copyright 2001-2012 Strangecode, LLC 6 * 6 * 7 7 * This file is part of The Strangecode Codebase. 8 8 * … … 11 11 * Free Software Foundation, either version 3 of the License, or (at your option) 12 12 * any later version. 13 * 13 * 14 14 * The Strangecode Codebase is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 17 * details. 18 * 18 * 19 19 * You should have received a copy of the GNU General Public License along with 20 20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 30 30 * Created with PHPUnit_Skeleton on 2005-08-09 31 31 */ 32 require_once 'PHPUnit.php'; 33 class DBSessionHandlerTest extends PHPUnit_ TestCase {32 33 class DBSessionHandlerTest extends PHPUnit_Framework_TestCase { 34 34 35 35 var $DBSessionHandler; 36 37 function DBSessionHandlerTest($name)38 {39 $this->PHPUnit_TestCase($name);40 }41 36 42 37 function setUp() … … 73 68 function test_DBsessionwrite() 74 69 { 70 if (!isset($_SESSION)) { 71 $_SESSION = array(); 72 } 75 73 $this->DBSessionHandler->DBsessionwrite(session_id(), serialize($_SESSION)); 76 74 } … … 87 85 88 86 } 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 1 1 <?php 2 2 3 /** 3 4 * The Strangecode Codebase - a general application development framework for PHP … … 30 31 * Created with PHPUnit_Skeleton on 2005-12-01 31 32 */ 32 require_once 'PHPUnit.php'; 33 class EmailTest extends PHPUnit_ TestCase {33 34 class EmailTest extends PHPUnit_Framework_TestCase { 34 35 35 36 var $Email; 36 37 function EmailTest($name)38 {39 $this->PHPUnit_TestCase($name);40 }41 37 42 38 function setUp() … … 44 40 require dirname(__FILE__) . '/_config.inc.php'; 45 41 require_once '../lib/Email.inc.php'; 46 $this->Email = &new Email();42 $this->Email = new Email(); 47 43 } 48 44 … … 122 118 123 119 } 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 30 30 * Created with PHPUnit_Skeleton on 2005-08-09 31 31 */ 32 require_once 'PHPUnit.php'; 33 class FormValidatorTest extends PHPUnit_ TestCase {32 33 class FormValidatorTest extends PHPUnit_Framework_TestCase { 34 34 35 35 var $FormValidator; 36 37 function FormValidatorTest($name)38 {39 $this->PHPUnit_TestCase($name);40 }41 36 42 37 function setUp() … … 44 39 require dirname(__FILE__) . '/_config.inc.php'; 45 40 require_once '../lib/FormValidator.inc.php'; 46 $this->FormValidator = &new FormValidator();41 $this->FormValidator = new FormValidator(); 47 42 } 48 43 … … 294 289 295 290 } 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 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class GoogleAPITest extends PHPUnit_ TestCase {35 36 class GoogleAPITest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $GoogleAPI; … … 40 40 function GoogleAPITest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 91 91 92 92 } 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 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class HierarchyTest extends PHPUnit_ TestCase {35 36 class HierarchyTest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $Hierarchy; … … 40 40 function HierarchyTest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 175 175 176 176 } 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 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class ImageThumbTest extends PHPUnit_ TestCase {35 36 class ImageThumbTest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $ImageThumb; … … 40 40 function ImageThumbTest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 119 119 120 120 } 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 30 30 * Created with PHPUnit_Skeleton on 2005-08-09 31 31 */ 32 require_once 'PHPUnit.php'; 33 class LockTest extends PHPUnit_ TestCase {32 33 class LockTest extends PHPUnit_Framework_TestCase { 34 34 35 35 var $Lock; 36 36 var $Auth_SQL; 37 38 function LockTest($name)39 {40 $this->PHPUnit_TestCase($name);41 }42 37 43 38 function setUp() … … 47 42 require_once '../lib/Auth_SQL.inc.php'; 48 43 49 $this->Auth_SQL = &new Auth_SQL('test');44 $this->Auth_SQL = new Auth_SQL('test'); 50 45 $this->Auth_SQL->setParam(array( 51 46 'db_table' => 'test_user_tbl', … … 208 203 { 209 204 $result = $this->Lock->getsecondselapsed(); 210 $this->assert Type('integer', $result);205 $this->assertInternalType('integer', $result); 211 206 } 212 207 213 208 } 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 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class MCVETest extends PHPUnit_ TestCase {35 36 class MCVETest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $MCVE; … … 40 40 function MCVETest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 91 91 92 92 } 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 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class NavigationTest extends PHPUnit_ TestCase {35 36 class NavigationTest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $Navigation; … … 40 40 function NavigationTest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 133 133 134 134 } 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 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class PEditTest extends PHPUnit_ TestCase {35 36 class PEditTest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $PEdit; … … 40 40 function PEditTest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 154 154 155 155 } 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 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class PageNumbersTest extends PHPUnit_ TestCase {35 36 class PageNumbersTest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $PageNumbers; … … 40 40 function PageNumbersTest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 133 133 134 134 } 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 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class PageSequenceTest extends PHPUnit_ TestCase {35 36 class PageSequenceTest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $PageSequence; … … 40 40 function PageSequenceTest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 182 182 183 183 } 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 30 30 * Created with PHPUnit_Skeleton on 2005-08-09 31 31 */ 32 require_once 'PHPUnit.php'; 33 class PayPalTest extends PHPUnit_ TestCase {32 33 class PayPalTest extends PHPUnit_Framework_TestCase { 34 34 35 35 var $PayPal; 36 37 function PayPalTest($name)38 {39 $this->PHPUnit_TestCase($name);40 }41 36 42 37 function setUp() … … 44 39 require dirname(__FILE__) . '/_config.inc.php'; 45 40 require_once '../lib/PayPal.inc.php'; 46 $this->PayPal = &new PayPal();41 $this->PayPal = new PayPal(); 47 42 48 43 // Defaults for purchasing classified postings. … … 90 85 )); 91 86 $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)); 93 89 } 94 90 … … 103 99 $this->PayPal->printbutton('testitem'); 104 100 $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 106 104 } 107 105 … … 134 132 135 133 } 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 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class PrefsTest extends PHPUnit_ TestCase {35 36 class PrefsTest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $Prefs; … … 40 40 function PrefsTest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 112 112 113 113 } 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 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class ScriptTimerTest extends PHPUnit_ TestCase {35 36 class ScriptTimerTest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $ScriptTimer; … … 40 40 function ScriptTimerTest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 77 77 78 78 } 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 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class SortOrderTest extends PHPUnit_ TestCase {35 36 class SortOrderTest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $SortOrder; … … 40 40 function SortOrderTest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 91 91 92 92 } 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 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class SpellCheckTest extends PHPUnit_ TestCase {35 36 class SpellCheckTest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $SpellCheck; … … 40 40 function SpellCheckTest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 154 154 155 155 } 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 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class TemplateGlueTest extends PHPUnit_ TestCase {35 36 class TemplateGlueTest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $TemplateGlue; … … 40 40 function TemplateGlueTest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 56 56 57 57 } 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 7 7 * For details visit the project site: <http://trac.strangecode.com/codebase/> 8 8 * Copyright 2001-2012 Strangecode, LLC 9 * 9 * 10 10 * This file is part of The Strangecode Codebase. 11 11 * … … 14 14 * Free Software Foundation, either version 3 of the License, or (at your option) 15 15 * any later version. 16 * 16 * 17 17 * The Strangecode Codebase is distributed in the hope that it will be useful, but 18 18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19 19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 20 20 * details. 21 * 21 * 22 22 * You should have received a copy of the GNU General Public License along with 23 23 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class UploadTest extends PHPUnit_ TestCase {35 36 class UploadTest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $Upload; … … 40 40 function UploadTest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 120 120 function test_getfilenameextension() 121 121 { 122 $result = $this->Upload ->getfilenameextension(PARAM);122 $result = $this->Upload::getfilenameextension(PARAM); 123 123 $expected = EXPECTED_VAL; 124 124 $this->assertEquals($expected, $result); … … 126 126 127 127 } 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 33 33 * Created with PHPUnit_Skeleton on 2005-08-09 34 34 */ 35 require_once 'PHPUnit.php'; 36 class UtilitiesTest extends PHPUnit_ TestCase {35 36 class UtilitiesTest extends PHPUnit_Framework_TestCase { 37 37 38 38 var $Utilities; … … 40 40 function UtilitiesTest($name) 41 41 { 42 $this->PHPUnit_ TestCase($name);42 $this->PHPUnit_Framework_TestCase($name); 43 43 } 44 44 … … 56 56 57 57 } 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 30 30 * Created with PHPUnit_Skeleton on 2005-08-09 31 31 */ 32 require_once 'PHPUnit.php'; 33 class VersionTest extends PHPUnit_ TestCase {32 33 class VersionTest extends PHPUnit_Framework_TestCase { 34 34 35 35 var $Version; 36 36 var $Auth_SQL; 37 38 function VersionTest($name)39 {40 $this->PHPUnit_TestCase($name);41 }42 37 43 38 function setUp() … … 47 42 48 43 require_once '../lib/Auth_SQL.inc.php'; 49 $this->Auth_SQL = &new Auth_SQL('testauth');44 $this->Auth_SQL = new Auth_SQL('testauth'); 50 45 $this->Auth_SQL->setParam(array( 51 46 'db_table' => 'test_user_tbl', … … 116 111 { 117 112 $result = $this->Version->create('test_user_tbl', 'user_id', '1', 'Test User', 'First version of user'); 118 $this->assert True($result);113 $this->assertSame(1, $result); 119 114 } 120 115 … … 190 185 191 186 } 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 4 4 * For details visit the project site: <http://trac.strangecode.com/codebase/> 5 5 * Copyright 2001-2012 Strangecode, LLC 6 * 6 * 7 7 * This file is part of The Strangecode Codebase. 8 8 * … … 11 11 * Free Software Foundation, either version 3 of the License, or (at your option) 12 12 * any later version. 13 * 13 * 14 14 * The Strangecode Codebase is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 17 * details. 18 * 18 * 19 19 * You should have received a copy of the GNU General Public License along with 20 20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 28 28 */ 29 29 require_once '../lib/App.inc.php'; 30 30 31 $app =& App::getInstance('testapp'); 31 32 … … 44 45 'db_die_on_failure' => true, 45 46 'db_server' => 'localhost', 46 'db_name' => 'test',47 'db_user' => 'root',47 'db_name' => getenv('DB_NAME'), 48 'db_user' => getenv('DB_USER'), 48 49 'db_pass' => getenv('DB_PASS'), 49 50 'display_errors' => true, … … 59 60 60 61 $app->start(); 61 ?> -
trunk/tests/_skel.php
r412 r468 78 78 // } 79 79 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="..." 2 9 3 10 # Be in the directory with all the tests. 4 11 cd `dirname $0`; 5 12 13 # Get required ENV variables. 14 if [[ -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."; 16 fi 17 for E in DB_USER DB_PASS DB_NAME; do 18 while [[ -z ${!E} ]]; do 19 read -p "$E: " $E; 20 done 21 export $E; 22 done 23 6 24 # Create database. 7 25 mysql -e 'CREATE DATABASE IF NOT EXISTS `test`'; 8 26 9 # Run tests sequentially. 10 for foo in *Test.php; 11 do 12 php $foo; 13 done; 27 # Go! 28 echo "Running the tests!"; 29 echo "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 ' 33 phpunit --stderr
Note: See TracChangeset
for help on using the changeset viewer.