Make WordPress Core


Ignore:
Timestamp:
10/11/2022 09:58:27 AM (2 years ago)
Author:
audrasjb
Message:

Build/Test Tools: Add unit test for non-existing block-styles registration.

Follow-up to [54155].

Props aristath, mukesh27.
Fixes #56664.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/blocks/register.php

    r54331 r54472  
    373373            wp_normalize_path( wp_styles()->get_data( 'unit-tests-test-block-style', 'path' ) )
    374374        );
     375    }
     376
     377    /**
     378     * @ticket 56664
     379     */
     380    public function test_register_nonexistent_stylesheet() {
     381        $metadata = array(
     382            'file'  => DIR_TESTDATA . '/blocks/notice/block.json',
     383            'name'  => 'unit-tests/test-block-nonexistent-stylesheet',
     384            'style' => 'file:./nonexistent.css',
     385        );
     386        register_block_style_handle( $metadata, 'style' );
     387
     388        global $wp_styles;
     389        $this->assertFalse( $wp_styles->registered['unit-tests-test-block-nonexistent-stylesheet-style']->src );
    375390    }
    376391
Note: See TracChangeset for help on using the changeset viewer.