WordPress.org

Make WordPress Core

Changeset 584 in tests


Ignore:
Timestamp:
03/20/12 19:46:53 (2 years ago)
Author:
nacin
Message:

Fix failing tests in TestUploadFunctions. see #27.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_uploads.php

    r407 r584  
    1313        update_option( 'upload_url_path', '' ); 
    1414        update_option( 'uploads_use_yearmonth_folders', 1 ); 
     15    } 
    1516 
     17    // See #UT27 
     18    function _maybe_absolute_uploads_url( $url ) { 
     19        if ( '/wp-content' == WP_CONTENT_URL ) 
     20            return $url; 
     21 
     22        return $this->siteurl . $url; 
    1623    } 
    1724 
     
    1926        // wp_upload_dir() with default parameters 
    2027        $info = wp_upload_dir(); 
    21         $this->assertEquals( $this->siteurl . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] ); 
     28        $this->assertEquals( $this->_maybe_absolute_uploads_url( '/wp-content/uploads/' ) . gmstrftime('%Y/%m'), $info['url'] ); 
    2229        $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] ); 
    2330        $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] ); 
     
    2633 
    2734    function test_upload_dir_relative() { 
    28         // wp_upload_dir() with a relative upload path 
     35        // wp_upload_dir() with a relative upload path that is not 'wp-content/uploads' 
    2936        update_option( 'upload_path', 'foo/bar' ); 
    3037        $info = wp_upload_dir(); 
     
    5158        update_option( 'uploads_use_yearmonth_folders', 0 ); 
    5259        $info = wp_upload_dir(); 
    53         $this->assertEquals( $this->siteurl . '/wp-content/uploads', $info['url'] ); 
     60        $this->assertEquals( $this->_maybe_absolute_uploads_url( '/wp-content/uploads' ), $info['url'] ); 
    5461        $this->assertEquals( ABSPATH . 'wp-content/uploads', $info['path'] ); 
    5562        $this->assertEquals( '', $info['subdir'] ); 
     
    7077        update_option('upload_path', ''); 
    7178        $info = wp_upload_dir(); 
    72         $this->assertEquals( $this->siteurl . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] ); 
     79        $this->assertEquals( $this->_maybe_absolute_uploads_url( '/wp-content/uploads/' ) . gmstrftime('%Y/%m'), $info['url'] ); 
    7380        $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] ); 
    7481        $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] ); 
Note: See TracChangeset for help on using the changeset viewer.