Changeset 337135
- Timestamp:
- 01/25/2011 06:07:18 PM (15 years ago)
- Location:
- wp-unit/trunk
- Files:
-
- 2 edited
-
WPUnit.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-unit/trunk/WPUnit.php
r331858 r337135 4 4 Description: Unit Test Development 5 5 Version: 1.0 6 Author: WidgiLabs Team6 Author: WidgiLabs team 7 7 Author URI: http://widgilabs.com 8 8 /usr/local/php5/bin:/Users/aaires/Projects/android/sdk:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/usr/local/bin:/sw/bin:/sw/sbin:/usr/local/bin … … 67 67 $result = new PHPUnit_Framework_TestResult; 68 68 $printer = new PHPUnit_TextUI_ResultPrinter; 69 $result= wptest_run_tests($classes, @$opts['t']);70 71 wptest_print_result($ result);69 list ($result, $printer) = wptest_run_tests($classes, @$opts['t']); 70 71 wptest_print_result($printer,$result); 72 72 73 73 } … … 75 75 } 76 76 77 78 79 80 77 81 78 82 /**********************************************Wordpress Stuff ****************************/ 79 // Taken from wp-testlib80 81 83 // simple functions for loading and running tests 82 84 /*This was retrieve from the unit test framework done by Wordpress*/ … … 139 141 140 142 require_once('PHPUnit/TextUI/ResultPrinter.php'); 141 142 return $suite->run($result);143 } 144 145 /*end WordPress stuff*/ 146 147 // Parse the results 148 function wptest_print_result(PHPUnit_ Framework_TestResult $result) {143 144 $printer = new PHPUnit_TextUI_ResultPrinter(NULL,true,true); 145 $result->addListener($printer); 146 147 return array($suite->run($result), $printer); 148 } 149 150 function wptest_print_result(PHPUnit_TextUI_ResultPrinter $printer, PHPUnit_Framework_TestResult $result) { 149 151 150 152 … … 272 274 } 273 275 276 /** 277 * Return and/or display the time from the page start to when function is called. 278 * 279 * You can get the results and print them by doing: 280 * <code> 281 * $nTimePageTookToExecute = timer_stop(); 282 * echo $nTimePageTookToExecute; 283 * </code> 284 * 285 * Or instead, you can do: 286 * <code> 287 * timer_stop(1); 288 * </code> 289 * which will do what the above does. If you need the result, you can assign it to a variable, but 290 * most cases, you only need to echo it. 291 * 292 * @since 0.71 293 * @global int $timestart Seconds and Microseconds added together from when timer_start() is called 294 * @global int $timeend Seconds and Microseconds added together from when function is called 295 * 296 * @param int $display Use '0' or null to not echo anything and 1 to echo the total time 297 * @param int $precision The amount of digits from the right of the decimal to display. Default is 3. 298 * @return float The "second.microsecond" finished time calculation 299 */ 300 //function timer_stop( $display = 0, $precision = 3 ) { // if called like timer_stop(1), will echo $timetotal 301 // global $timestart, $timeend; 302 // $mtime = microtime(); 303 // $mtime = explode( ' ', $mtime ); 304 // $timeend = $mtime[1] + $mtime[0]; 305 // $timetotal = $timeend - $timestart; 306 // $r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision ); 307 // if ( $display ) 308 // echo $r; 309 // return $r; 310 //} 311 /*end WordPress stuff*/ 312 274 313 275 314 -
wp-unit/trunk/readme.txt
r331858 r337135 4 4 Tags: unit-testing, phpunit 5 5 Requires at least: 3.0 6 Tested up to: 3.0 7 Stable tag: 1.16 Tested up to: 3.0.4 7 Stable tag: 2.0 8 8 9 9 == Description == 10 10 11 11 Enables you to create unit tests for your plugins, run and check the results in a centralized way. 12 It depends on phpunit so you must install it before you use this plugin.12 It uses phpunit. 13 13 14 14 Its based on the WordPress automated system but distributed as a plugin. Also it does not require a new database and a new configuration file so when you create your unit tests pay special attention to your database access so you keep a consistent database. … … 31 31 == Changelog == 32 32 33 == Upgrade Notice == 33 1.2 Bundle phpunit. 34 35 1.1 Initial version 36 37 == Upgrade Notice == 38 39 None. 34 40 35 41 == Screenshots == 36 42 37 43 None.
Note: See TracChangeset
for help on using the changeset viewer.