/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
phpunit/block-template-test.php
37 строк
923 B
Albert Juhé Lluveras
Rename wp_register_block_template() to register_block_template() (#65958)
09 окт 2024, 20:44
Не верифицирован
09 окт 2024, 20:44
fc62bf6
Код
Авторство
О чём код?
<?php /** * Tests block template registry via block-related functions. */ class Tests_Block_Template extends WP_UnitTestCase { public function set_up() { parent::set_up(); switch_theme( 'block-theme' ); } public function test_get_block_templates_from_registry() { $template_name = 'test-plugin//test-template'; register_block_template( $template_name ); $templates = get_block_templates(); $this->assertArrayHasKey( $template_name, $templates ); unregister_block_template( $template_name ); } public function test_get_block_template_from_registry() { $template_name = 'test-plugin//test-template'; $args = array( 'title' => 'Test Template', ); register_block_template( $template_name, $args ); $template = get_block_template( 'block-theme//test-template' ); $this->assertEquals( 'Test Template', $template->title ); unregister_block_template( $template_name ); } }