From 44575d6dca473a81de13305fb8cbacf00ca88863 Mon Sep 17 00:00:00 2001 From: Matt Sherman Date: Thu, 24 Aug 2023 21:32:35 -0400 Subject: [PATCH] Add title attribute to custom block to facilitate easier testing --- .../src/Internal/Admin/BlockTemplates/CustomBlock.php | 9 +++++++-- .../Admin/BlockTemplates/CustomBlockInterface.php | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/woocommerce/tests/php/src/Internal/Admin/BlockTemplates/CustomBlock.php b/plugins/woocommerce/tests/php/src/Internal/Admin/BlockTemplates/CustomBlock.php index 46f524aaa3f..f601d196db2 100644 --- a/plugins/woocommerce/tests/php/src/Internal/Admin/BlockTemplates/CustomBlock.php +++ b/plugins/woocommerce/tests/php/src/Internal/Admin/BlockTemplates/CustomBlock.php @@ -18,11 +18,16 @@ class CustomBlock extends AbstractBlock implements CustomBlockInterface { /** * Custom method. + * + * @param string $title The title. */ - public function add_custom_inner_block(): BlockInterface { + public function add_custom_inner_block( string $title ): BlockInterface { $block = new Block( [ - 'blockName' => 'custom-inner-block', + 'blockName' => 'custom-inner-block', + 'attributes' => [ + 'title' => $title, + ], ], $this->get_root_template(), $this diff --git a/plugins/woocommerce/tests/php/src/Internal/Admin/BlockTemplates/CustomBlockInterface.php b/plugins/woocommerce/tests/php/src/Internal/Admin/BlockTemplates/CustomBlockInterface.php index dbaf133a8c8..f920aadcc2d 100644 --- a/plugins/woocommerce/tests/php/src/Internal/Admin/BlockTemplates/CustomBlockInterface.php +++ b/plugins/woocommerce/tests/php/src/Internal/Admin/BlockTemplates/CustomBlockInterface.php @@ -8,6 +8,8 @@ use Automattic\WooCommerce\Admin\BlockTemplates\BlockInterface; interface CustomBlockInterface extends BlockContainerInterface { /** * Adds a method to insert a specific custom inner block. + * + * @param string $title The title. */ - public function add_custom_inner_block(): BlockInterface; + public function add_custom_inner_block( string $title ): BlockInterface; }