Changeset 56621 for trunk/tests/phpunit/tests/block-template.php
- Timestamp:
- 09/19/2023 04:15:52 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/block-template.php
r56559 r56621 277 277 278 278 /** 279 * @ticket 58319 280 * 281 * @covers ::get_block_theme_folders 282 * 283 * @dataProvider data_get_block_theme_folders 284 * 285 * @param string $theme The theme's stylesheet. 286 * @param string[] $expected The expected associative array of block theme folders. 287 */ 288 public function test_get_block_theme_folders( $theme, $expected ) { 289 $wp_theme = wp_get_theme( $theme ); 290 $wp_theme->cache_delete(); // Clear cache. 291 292 $this->assertSame( $expected, get_block_theme_folders( $theme ), 'Incorrect block theme folders were retrieved.' ); 293 $reflection = new ReflectionMethod( $wp_theme, 'cache_get' ); 294 $reflection->setAccessible( true ); 295 $theme_cache = $reflection->invoke( $wp_theme, 'theme' ); 296 $cached_value = $theme_cache['block_template_folders']; 297 $reflection->setAccessible( false ); 298 299 $this->assertSame( $expected, $cached_value, 'The cached value is incorrect.' ); 300 } 301 302 /** 303 * Data provider. 304 * 305 * @return array[] 306 */ 307 public function data_get_block_theme_folders() { 308 return array( 309 'block-theme' => array( 310 'block-theme', 311 array( 312 'wp_template' => 'templates', 313 'wp_template_part' => 'parts', 314 ), 315 ), 316 'block-theme-deprecated-path' => array( 317 'block-theme-deprecated-path', 318 array( 319 'wp_template' => 'block-templates', 320 'wp_template_part' => 'block-template-parts', 321 ), 322 ), 323 'block-theme-child' => array( 324 'block-theme-child', 325 array( 326 'wp_template' => 'templates', 327 'wp_template_part' => 'parts', 328 ), 329 ), 330 'block-theme-child-deprecated-path' => array( 331 'block-theme-child-deprecated-path', 332 array( 333 'wp_template' => 'block-templates', 334 'wp_template_part' => 'block-template-parts', 335 ), 336 ), 337 'this-is-an-invalid-theme' => array( 338 'this-is-an-invalid-theme', 339 array( 340 'wp_template' => 'templates', 341 'wp_template_part' => 'parts', 342 ), 343 ), 344 'null' => array( 345 null, 346 array( 347 'wp_template' => 'templates', 348 'wp_template_part' => 'parts', 349 ), 350 ), 351 ); 352 } 353 354 /** 279 355 * Registers a test block to log `in_the_loop()` results. 280 356 *
Note: See TracChangeset
for help on using the changeset viewer.