From 5b5e1bb8c9424ca3482d1495ccbd1afc473c0798 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Tue, 11 Oct 2022 09:58:27 +0000 Subject: [PATCH] Build/Test Tools: Add unit test for non-existing block-styles registration. Follow-up to [54155]. Props aristath, mukesh27. Fixes #56664. git-svn-id: https://develop.svn.wordpress.org/trunk@54472 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/blocks/register.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/phpunit/tests/blocks/register.php b/tests/phpunit/tests/blocks/register.php index ea6df5057e..554f09c2d2 100644 --- a/tests/phpunit/tests/blocks/register.php +++ b/tests/phpunit/tests/blocks/register.php @@ -374,6 +374,21 @@ class Tests_Blocks_Register extends WP_UnitTestCase { ); } + /** + * @ticket 56664 + */ + public function test_register_nonexistent_stylesheet() { + $metadata = array( + 'file' => DIR_TESTDATA . '/blocks/notice/block.json', + 'name' => 'unit-tests/test-block-nonexistent-stylesheet', + 'style' => 'file:./nonexistent.css', + ); + register_block_style_handle( $metadata, 'style' ); + + global $wp_styles; + $this->assertFalse( $wp_styles->registered['unit-tests-test-block-nonexistent-stylesheet-style']->src ); + } + /** * @ticket 55513 */