Changeset 55567
- Timestamp:
- 03/20/2023 06:20:05 PM (2 years ago)
- Location:
- trunk/tests/phpunit/tests/theme
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme/wpGetGlobalStylesheet.php
r55148 r55567 55 55 } 56 56 57 /**58 * Cleans up global scope.59 *60 * @global WP_Styles $wp_styles61 */62 public function clean_up_global_scope() {63 global $wp_styles;64 parent::clean_up_global_scope();65 $wp_styles = null;66 }67 68 57 public function filter_set_theme_root() { 69 58 return $this->theme_root; … … 211 200 } 212 201 213 /**214 * Tests that stored CSS is enqueued.215 *216 * @ticket 56467217 *218 * @covers ::wp_enqueue_stored_styles219 */220 public function test_should_enqueue_stored_styles() {221 $core_styles_to_enqueue = array(222 array(223 'selector' => '.saruman',224 'declarations' => array(225 'color' => 'white',226 'height' => '100px',227 'border-style' => 'solid',228 ),229 ),230 );231 232 // Enqueues a block supports (core styles).233 wp_style_engine_get_stylesheet_from_css_rules(234 $core_styles_to_enqueue,235 array(236 'context' => 'block-supports',237 )238 );239 240 $my_styles_to_enqueue = array(241 array(242 'selector' => '.gandalf',243 'declarations' => array(244 'color' => 'grey',245 'height' => '90px',246 'border-style' => 'dotted',247 ),248 ),249 );250 251 // Enqueues some other styles.252 wp_style_engine_get_stylesheet_from_css_rules(253 $my_styles_to_enqueue,254 array(255 'context' => 'my-styles',256 )257 );258 259 wp_enqueue_stored_styles( array( 'prettify' => false ) );260 261 $this->assertSame(262 array( '.saruman{color:white;height:100px;border-style:solid;}' ),263 wp_styles()->registered['core-block-supports']->extra['after'],264 'Registered styles with handle of "core-block-supports" do not match expected value from Style Engine store.'265 );266 267 $this->assertSame(268 array( '.gandalf{color:grey;height:90px;border-style:dotted;}' ),269 wp_styles()->registered['wp-style-engine-my-styles']->extra['after'],270 'Registered styles with handle of "wp-style-engine-my-styles" do not match expected value from the Style Engine store.'271 );272 }273 202 /** 274 203 * Tests that switching themes recalculates the stylesheet.
Note: See TracChangeset
for help on using the changeset viewer.