Changeset 52314
- Timestamp:
- 12/03/2021 04:57:19 PM (3 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/block-template-utils.php
r52286 r52314 14 14 private static $post; 15 15 private static $template_part_post; 16 private static $test_theme = 'block-theme'; 16 17 17 18 public static function wpSetUpBeforeClass() { 18 // We may need a block theme.19 // switch_theme( 'tt1-blocks' );20 21 19 // Set up a template post corresponding to a different theme. 22 20 // We do this to ensure resolution and slug creation works as expected, … … 46 44 'tax_input' => array( 47 45 'wp_theme' => array( 48 get_stylesheet(),46 self::$test_theme, 49 47 ), 50 48 ), 51 49 ); 52 50 self::$post = self::factory()->post->create_and_get( $args ); 53 wp_set_post_terms( self::$post->ID, get_stylesheet(), 'wp_theme' );51 wp_set_post_terms( self::$post->ID, self::$test_theme, 'wp_theme' ); 54 52 55 53 // Set up template part post. … … 62 60 'tax_input' => array( 63 61 'wp_theme' => array( 64 get_stylesheet(),62 self::$test_theme, 65 63 ), 66 64 'wp_template_part_area' => array( … … 71 69 self::$template_part_post = self::factory()->post->create_and_get( $template_part_args ); 72 70 wp_set_post_terms( self::$template_part_post->ID, WP_TEMPLATE_PART_AREA_HEADER, 'wp_template_part_area' ); 73 wp_set_post_terms( self::$template_part_post->ID, get_stylesheet(), 'wp_theme' ); 71 wp_set_post_terms( self::$template_part_post->ID, self::$test_theme, 'wp_theme' ); 72 } 73 74 public function set_up() { 75 parent::set_up(); 76 switch_theme( self::$test_theme ); 74 77 } 75 78 … … 226 229 */ 227 230 function test_get_block_template_from_file() { 228 $this->markTestIncomplete(); 229 // Requires switching to a block theme. 230 /* $id = get_stylesheet() . '//' . 'index'; 231 $id = get_stylesheet() . '//' . 'index'; 231 232 $template = get_block_template( $id, 'wp_template' ); 232 233 $this->assertSame( $id, $template->id ); … … 238 239 239 240 // Test template parts. 240 $id = get_stylesheet() . '//' . ' header';241 $id = get_stylesheet() . '//' . 'small-header'; 241 242 $template = get_block_template( $id, 'wp_template_part' ); 242 243 $this->assertSame( $id, $template->id ); 243 244 $this->assertSame( get_stylesheet(), $template->theme ); 244 $this->assertSame( ' header', $template->slug );245 $this->assertSame( 'small-header', $template->slug ); 245 246 $this->assertSame( 'publish', $template->status ); 246 247 $this->assertSame( 'theme', $template->source ); 247 248 $this->assertSame( 'wp_template_part', $template->type ); 248 249 $this->assertSame( WP_TEMPLATE_PART_AREA_HEADER, $template->area ); 249 */250 250 } 251 251
Note: See TracChangeset
for help on using the changeset viewer.