Make WordPress Core

Ticket #30036: unit-test.test_awkward_handles_are_supported_consistently.diff

File unit-test.test_awkward_handles_are_supported_consistently.diff, 1.6 KB (added by georgestephanis, 9 years ago)
  • tests/phpunit/tests/dependencies/styles.php

     
    4444        }
    4545
    4646        /**
     47         * Test assorted handles to make sure we don't break how they output.
     48         */
     49        public function test_awkward_handles_are_supported_consistently() {
     50                wp_enqueue_style( 'with some spaces',     'example.com', array(), null );
     51                wp_enqueue_style( 'with-☃-snowman',       'example.com', array(), null );
     52                wp_enqueue_style( 'with-trailing-space ', 'example.com', array(), null );
     53                wp_enqueue_style( ' with-leading-space',  'example.com', array(), null );
     54                wp_enqueue_style( 'an "ironic" title',    'example.com', array(), null );
     55
     56                $expected  = "<link rel='stylesheet' id='with some spaces-css'  href='http://example.com' type='text/css' media='all' />\n";
     57                $expected .= "<link rel='stylesheet' id='with-☃-snowman-css'  href='http://example.com' type='text/css' media='all' />\n";
     58                $expected .= "<link rel='stylesheet' id='with-trailing-space -css'  href='http://example.com' type='text/css' media='all' />\n";
     59                $expected .= "<link rel='stylesheet' id=' with-leading-space-css'  href='http://example.com' type='text/css' media='all' />\n";
     60                $expected .= "<link rel='stylesheet' id='an \"ironic\" title-css'  href='http://example.com' type='text/css' media='all' />\n";
     61
     62                $this->assertEquals( $expected, get_echo( 'wp_print_styles' ) );
     63        }
     64
     65        /**
    4766         * Test the different protocol references in wp_enqueue_style
    4867         * @global WP_Styles $wp_styles
    4968         * @ticket 16560