Changeset 101 in tests
- Timestamp:
- 12/03/2007 10:52:17 PM (18 years ago)
- Files:
-
- 2 edited
-
wp-test.php (modified) (2 diffs)
-
wp-testlib/base.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-test.php
r85 r101 22 22 // make sure errors are displayed during setup 23 23 error_reporting(E_ALL); 24 ini_set('display_errors', '1');24 ini_set('display_errors', true); 25 25 26 26 require_once(DIR_TESTROOT.'/wp-testlib/base.php'); … … 87 87 do_action('test_start'); 88 88 89 // hide errors during test runs, since they're captured and reported by the test framework90 ini_set('display_errors', '0');89 // hide warnings during testing, since that's the normal WP behaviour 90 error_reporting(E_ALL ^ E_NOTICE); 91 91 // run the tests and print the results 92 92 $result = wptest_run_tests($classes, @$opts['t']); -
wp-testlib/base.php
r86 r101 18 18 // error types taken from PHPUnit_Framework_TestResult::run 19 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 20 $this->_old_handler = set_error_handler(array(&$this, '_error_handler')); 24 21 if (is_null($this->_old_handler)) { … … 38 35 function _error_handler($errno, $errstr, $errfile, $errline) { 39 36 // @ in front of statement 40 if ( 0 == ini_get('error_reporting')) {37 if (error_reporting() == 0) { 41 38 return; 42 39 } 40 // notices and strict warnings are passed on to the phpunit error handler but don't trigger an exception 43 41 if ($errno | $this->_phpunit_err_mask) { 44 42 PHPUnit_Util_ErrorHandler($errno, $errstr, $errfile, $errline); 45 } else { 43 } 44 // warnings and errors trigger an exception, which is included in the test results 45 else { 46 46 error_log("Testing: $errstr in $errfile on line $errline"); 47 47 //TODO: we should raise custom exception here, sth like WP_PHPError 48 throw new PHPUnit_Framework_Error(48 throw new PHPUnit_Framework_Error( 49 49 $errstr, 50 50 $errno,
Note: See TracChangeset
for help on using the changeset viewer.