Changeset 918 in tests
- Timestamp:
- 07/19/2012 03:51:42 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bootstrap.php
r890 r918 79 79 require dirname( __FILE__ ) . '/includes/exceptions.php'; 80 80 require dirname( __FILE__ ) . '/includes/utils.php'; 81 82 /** 83 * A child class of the PHP test runner. 84 * 85 * Not actually used as a runner. Rather, used to access the protected 86 * longOptions property, to parse the arguments passed to the script. 87 * 88 * If it is determined that phpunit was called with a --group that corresponds 89 * to an @ticket annotation (such as `phpunit --group 12345` for bugs marked 90 * as #WP12345), then it is assumed that known bugs should not be skipped. 91 * 92 * If WP_TESTS_FORCE_KNOWN_BUGS is already set in wp-tests-config.php, then 93 * how you call phpunit has no effect. 94 */ 95 class WP_PHPUnit_TextUI_Command extends PHPUnit_TextUI_Command { 96 function __construct( $argv ) { 97 $options = PHPUnit_Util_Getopt::getopt( 98 $argv, 99 'd:c:hv', 100 array_keys( $this->longOptions ) 101 ); 102 foreach ( $options[0] as $option ) { 103 if ( $option[0] !== '--group' ) 104 continue; 105 $groups = explode( ',', $option[1] ); 106 foreach ( $groups as $group ) { 107 if ( is_numeric( $group ) || preg_match( '/^(UT|Plugin)\d+$/', $group ) ) 108 WP_UnitTestCase::forceTicket( $group ); 109 } 110 } 111 } 112 } 113 new WP_PHPUnit_TextUI_Command( $_SERVER['argv'] ); -
trunk/includes/testcase.php
r906 r918 1 1 <?php 2 2 3 require_once 'factory.php';4 require_once 'trac.php';3 require_once dirname( __FILE__ ) . '/factory.php'; 4 require_once dirname( __FILE__ ) . '/trac.php'; 5 5 6 6 class WP_UnitTestCase extends PHPUnit_Framework_TestCase { 7 8 protected static $forced_tickets = array(); 7 9 8 10 function setUp() { … … 128 130 $this->knownWPBug( $ticket ); 129 131 } elseif ( 'UT' == substr( $ticket, 0, 2 ) ) { 130 $this->knownUTBug( substr( $ticket, 2 ) ); 132 $ticket = substr( $ticket, 2 ); 133 if ( $ticket && is_numeric( $ticket ) ) 134 $this->knownUTBug( $ticket ); 135 } elseif ( 'Plugin' == substr( $ticket, 0, 6 ) ) { 136 $ticket = substr( $ticket, 6 ); 137 if ( $ticket && is_numeric( $ticket ) ) 138 $this->knownPluginBug( $ticket ); 131 139 } 132 140 } … … 137 145 */ 138 146 function knownWPBug( $ticket_id ) { 139 if ( ! WP_TESTS_FORCE_KNOWN_BUGS && ! TracTickets::isTracTicketClosed( 'http://core.trac.wordpress.org', $ticket_id ) ) { 147 if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( $ticket_id, self::$forced_tickets ) ) 148 return; 149 if ( ! TracTickets::isTracTicketClosed( 'http://core.trac.wordpress.org', $ticket_id ) ) 140 150 $this->markTestSkipped( sprintf( 'WordPress Ticket #%d is not fixed', $ticket_id ) ); 141 }142 151 } 143 152 … … 146 155 */ 147 156 function knownUTBug( $ticket_id ) { 148 if ( ! WP_TESTS_FORCE_KNOWN_BUGS && ! TracTickets::isTracTicketClosed( 'http://unit-tests.trac.wordpress.org', $ticket_id ) ) { 157 if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( 'UT' . $ticket_id, self::$forced_tickets ) ) 158 return; 159 if ( ! TracTickets::isTracTicketClosed( 'http://unit-tests.trac.wordpress.org', $ticket_id ) ) 149 160 $this->markTestSkipped( sprintf( 'Unit Tests Ticket #%d is not fixed', $ticket_id ) ); 150 }151 161 } 152 162 … … 155 165 */ 156 166 function knownPluginBug( $ticket_id ) { 157 if ( ! WP_TESTS_FORCE_KNOWN_BUGS && ! TracTickets::isTracTicketClosed( 'http://plugins.trac.wordpress.org', $ticket_id ) ) { 167 if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( 'Plugin' . $ticket_id, self::$forced_tickets ) ) 168 return; 169 if ( ! TracTickets::isTracTicketClosed( 'http://plugins.trac.wordpress.org', $ticket_id ) ) 158 170 $this->markTestSkipped( sprintf( 'WordPress Plugin Ticket #%d is not fixed', $ticket_id ) ); 159 } 171 } 172 173 public static function forceTicket( $ticket ) { 174 self::$forced_tickets[] = $ticket; 160 175 } 161 176
Note: See TracChangeset
for help on using the changeset viewer.