You appear to be a bot. Output may be restricted
Description
Should retrieve block templates.
Usage
Block_Template_Utils_Test::test_get_block_templates();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/block-template-utils.php
Lines:
1 to 28 of 28
public function test_get_block_templates() { function get_template_ids( $templates ) { return array_map( static function( $template ) { return $template->id; }, $templates ); } // All results. $templates = get_block_templates( array(), 'wp_template' ); $template_ids = get_template_ids( $templates ); // Avoid testing the entire array because the theme might add/remove templates. $this->assertContains( get_stylesheet() . '//' . 'my_template', $template_ids ); // Filter by slug. $templates = get_block_templates( array( 'slug__in' => array( 'my_template' ) ), 'wp_template' ); $template_ids = get_template_ids( $templates ); $this->assertSame( array( get_stylesheet() . '//' . 'my_template' ), $template_ids ); // Filter by CPT ID. $templates = get_block_templates( array( 'wp_id' => self::$post->ID ), 'wp_template' ); $template_ids = get_template_ids( $templates ); $this->assertSame( array( get_stylesheet() . '//' . 'my_template' ), $template_ids ); }