WordPress.org

Make WordPress Core

Changeset 894 in tests for trunk/includes/testcase.php


Ignore:
Timestamp:
07/09/2012 03:32:24 PM (10 years ago)
Author:
nacin
Message:

Convert knownWPBug and knownUTBug to @ticket annotations. fixes #102.

Allows for an extra description to be included with the annotation,
which will be passed to markTestSkipped().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/testcase.php

    r893 r894  
    125125        $tickets = PHPUnit_Util_Test::getTickets( get_class( $this ), $this->getName() );
    126126        foreach ( $tickets as $ticket ) {
     127            $annotation = explode( ' ', $ticket, 2 );
     128            $ticket     = $annotation[0];
     129            $message    = isset( $annotation[1] ) ? $annotation[1] : '';
     130
    127131            if ( is_numeric( $ticket ) ) {
    128                 $this->knownWPBug( $ticket );
     132                $this->knownWPBug( $ticket, $message );
    129133            } elseif ( 'UT' == substr( $ticket, 0, 2 ) ) {
    130                 $this->knownUTBug( substr( $ticket, 2 ) );
     134                $this->knownUTBug( substr( $ticket, 2 ), $message );
    131135            }
    132136        }
     
    136140     * Skips the current test if there is an open WordPress ticket with id $ticket_id
    137141     */
    138     function knownWPBug( $ticket_id ) {
     142    function knownWPBug( $ticket_id, $message = '' ) {
    139143        if ( ! WP_TESTS_FORCE_KNOWN_BUGS && ! TracTickets::isTracTicketClosed( 'http://core.trac.wordpress.org', $ticket_id ) ) {
    140             $this->markTestSkipped( sprintf( 'WordPress Ticket #%d is not fixed', $ticket_id ) );
     144            $this->markTestSkipped( sprintf( 'WordPress Ticket #%d is not fixed', $ticket_id ) . "\n" . $message );
    141145        }
    142146    }
     
    145149     * Skips the current test if there is an open unit tests ticket with id $ticket_id
    146150     */
    147     function knownUTBug( $ticket_id ) {
     151    function knownUTBug( $ticket_id, $message = '' ) {
    148152        if ( ! WP_TESTS_FORCE_KNOWN_BUGS && ! TracTickets::isTracTicketClosed( 'http://unit-tests.trac.wordpress.org', $ticket_id ) ) {
    149             $this->markTestSkipped( sprintf( 'Unit Tests Ticket #%d is not fixed', $ticket_id ) );
     153            $this->markTestSkipped( sprintf( 'Unit Tests Ticket #%d is not fixed', $ticket_id ) . "\n" . $message );
    150154        }
    151155    }
     
    154158     * Skips the current test if there is an open plugin ticket with id $ticket_id
    155159     */
    156     function knownPluginBug( $ticket_id ) {
     160    function knownPluginBug( $ticket_id, $message = '' ) {
    157161        if ( ! WP_TESTS_FORCE_KNOWN_BUGS && ! TracTickets::isTracTicketClosed( 'http://plugins.trac.wordpress.org', $ticket_id ) ) {
    158             $this->markTestSkipped( sprintf( 'WordPress Plugin Ticket #%d is not fixed', $ticket_id ) );
     162            $this->markTestSkipped( sprintf( 'WordPress Plugin Ticket #%d is not fixed', $ticket_id ) . "\n" . $message );
    159163        }
    160164    }
Note: See TracChangeset for help on using the changeset viewer.