WordPress.org

Make WordPress Core

Changeset 561 in tests


Ignore:
Timestamp:
03/02/2012 09:38:12 PM (6 years ago)
Author:
kurtpayne
Message:

Fix isTracTicketClosed() to work with tickets which contain tabs in the description. Fixes #UT26

Location:
wp-testlib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-testlib/base.php

    r548 r561  
    406406            return null;
    407407        }
    408         $titles = explode("\t", $lines[0]);
     408        $titles = str_getcsv( $lines[0], "\t" );
    409409        $status_idx = array_search('status', $titles);
    410410        if (false === $status_idx) {
    411411            return null;
    412412        }
    413         $tabs = explode("\t", $lines[1]);
     413        $tabs = str_getcsv( $lines[1], "\t" );
    414414        return 'closed' === $tabs[$status_idx];
    415415    }
  • wp-testlib/utils.php

    r336 r561  
    324324}
    325325
     326if ( !function_exists( 'str_getcsv' ) ) {
     327    function str_getcsv( $input, $delimiter = ',', $enclosure = '"', $escape = "\\" ) {
     328        $fp = fopen( 'php://temp/', 'r+' );
     329        fputs( $fp, $input );
     330        rewind( $fp );
     331        $data = fgetcsv( $fp, strlen( $input ), $delimiter, $enclosure );
     332        fclose( $fp );
     333        return $data;
     334    }
     335}
     336
    326337?>
Note: See TracChangeset for help on using the changeset viewer.