Make WordPress Core

Changeset 1004 in tests


Ignore:
Timestamp:
09/03/2012 11:42:29 PM (12 years ago)
Author:
nacin
Message:

Add some unit tests for WP_Theme's get_stylesheet_directory_uri() and
get_template_directory_uri() to raw urlencode the theme directory name.

see #WP21749.

Location:
trunk
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/theme/WPTheme.php

    r904 r1004  
    9494    }
    9595
     96    /**
     97     * @ticket 21749
     98     */
     99    function test_wp_theme_uris_with_spaces() {
     100        $theme = new WP_Theme( 'theme with spaces', $this->theme_root . '/subdir' );
     101        // Make sure subdir/ is considered part of the stylesheet, as we must avoid encoding /'s.
     102        $this->assertEquals( 'subdir/theme with spaces', $theme->get_stylesheet() );
     103        // Check that in a URI path, we have raw url encoding (spaces become %20)
     104        $this->assertEquals( $this->theme_root . '/subdir/theme%20with%20spaces', $theme->get_stylesheet_directory_uri() );
     105        $this->assertEquals( $this->theme_root . '/subdir/theme%20with%20spaces', $theme->get_template_directory_uri() );
     106        // Check that wp_customize_url() uses url encoding, as it is a query arg (spaces become +)
     107        $this->assertEquals( admin_url( 'customize.php?theme=theme+with+spaces' ), wp_customize_url( 'theme with spaces' ) );
     108    }
     109
    96110}
  • trunk/tests/theme/themeDir.php

    r909 r1004  
    138138            'My Subdir Theme',// theme in a subdirectory should work
    139139            'Page Template Theme', // theme with page templates for other test code
     140            'Theme with Spaces in the Directory',
    140141        );
    141142
Note: See TracChangeset for help on using the changeset viewer.