Changeset 39 in tests
- Timestamp:
- 09/27/2007 03:50:17 PM (17 years ago)
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
wp-test.php
r38 r39 47 47 48 48 // initialize wp 49 echo "Testing branch ".DIR_WP."\n";50 49 define('WP_INSTALLING', 1); 51 50 require_once(ABSPATH.'wp-settings.php'); -
wp-testcase/test_cron.php
r31 r39 11 11 12 12 function tearDown() { 13 parent::tearDown(); 13 14 // make sure the schedule is clear 14 15 _set_cron_array(array()); -
wp-testcase/test_includes_cache.php
r23 r39 5 5 6 6 function setUp() { 7 parent::setUp(); 7 8 // create two cache objects with a shared cache dir 8 9 // this simulates a typical cache situation, two separate requests interacting … … 12 13 13 14 function tearDown() { 15 parent::tearDown(); 14 16 wp_cache_flush(); 15 17 } -
wp-testcase/test_meta.php
r22 r39 6 6 7 7 function setUp() { 8 parent::setUp(); 8 9 $this->val = true; 9 10 } 10 11 11 12 function tearDown() { 13 parent::tearDown(); 12 14 $this->val = false; 13 15 } -
wp-testcase/test_user_capabilities.php
r16 r39 7 7 8 8 function setUp() { 9 parent::setUp(); 9 10 // keep track of users we create 10 11 $user_ids = array(); … … 12 13 13 14 function tearDown() { 15 parent::tearDown(); 14 16 // delete any users that were created during tests 15 17 foreach ($this->user_ids as $id) -
wp-testdata/sample_blogs.php
r27 r39 12 12 13 13 function setUp() { 14 parent::setUp(); 14 15 $this->author = get_userdatabylogin(WP_USER_NAME); 15 16 $this->_delete_all_posts(); -
wp-testlib/base.php
r32 r39 5 5 #require_once('PHPUnit.php'); 6 6 require_once('PHPUnit/Framework.php'); 7 require_once('PHPUnit/Util/ErrorHandler.php'); 7 8 8 9 // test cases should extend WPTestCase instead of PHPUnit_TestCase for three reasons: … … 13 14 14 15 class WPTestCase extends PHPUnit_Framework_TestCase { 16 17 function setUp() { 18 // error types taken from PHPUnit_Framework_TestResult::run 19 $this->_phpunit_err_mask = E_USER_ERROR | E_NOTICE | E_STRICT; 20 if (version_compare(phpversion(), '5.2.0RC1', '>=')) { 21 $this->_phpunit_err_mask |= E_RECOVERABLE_ERROR; 22 } 23 $this->_old_handler = set_error_handler(array(&$this, '_error_handler')); 24 if (is_null($this->_old_handler)) { 25 restore_error_handler(); 26 } 27 } 28 29 function tearDown() { 30 if (!is_null($this->_old_handler)) { 31 restore_error_handler(); 32 } 33 } 34 35 /** 36 * Treat any error, which wasn't handled by PHPUnit as a failure 37 */ 38 function _error_handler($errno, $errstr, $errfile, $errline) { 39 if ($errno | $this->_phpunit_err_mask) { 40 PHPUnit_Util_ErrorHandler($errno, $errstr, $errfile, $errline); 41 } else { 42 error_log("Testing: $errstr in $errfile on line $errline"); 43 //TODO: we should raise custom exception here, sth like WP_PHPError 44 throw new PHPUnit_Framework_Error( 45 $errstr, 46 $errno, 47 $errfile, 48 $errline, 49 $trace 50 ); 51 } 52 } 15 53 16 54 function _query_filter($q) {
Note: See TracChangeset
for help on using the changeset viewer.