<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[57590] trunk: Blocks: Allow reading the script handle from asset files</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/57590">57590</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/57590","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>gziolo</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-02-12 11:40:49 +0000 (Mon, 12 Feb 2024)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Blocks: Allow reading the script handle from asset files

In the [documentation for WPDefinedAsset definition](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#wpdefinedasset) for block metadata there is a note about the handle. That was missing in WordPress core.

Props gziolo, jsnajdr, youknowriad.
Fixes <a href="https://core.trac.wordpress.org/ticket/60485">#60485</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesblocksphp">trunk/src/wp-includes/blocks.php</a></li>
<li><a href="#trunktestsphpunittestsblocksregisterphp">trunk/tests/phpunit/tests/blocks/register.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunktestsphpunitdatablocksnoticesharedscriptassetphp">trunk/tests/phpunit/data/blocks/notice/shared-script.asset.php</a></li>
<li><a href="#trunktestsphpunitdatablocksnoticesharedscriptjs">trunk/tests/phpunit/data/blocks/notice/shared-script.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesblocksphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/blocks.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/blocks.php  2024-02-12 11:31:27 UTC (rev 57589)
+++ trunk/src/wp-includes/blocks.php    2024-02-12 11:40:49 UTC (rev 57590)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -191,7 +191,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 5.5.0
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 6.1.0 Added `$index` parameter.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 6.5.0 The asset file is optional.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.5.0 The asset file is optional. Added script handle support in the asset file.
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @param array  $metadata   Block metadata.
</span><span class="cx" style="display: block; padding: 0 10px">  * @param string $field_name Field name to pick from metadata.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -205,42 +205,49 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return false;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $script_handle = $metadata[ $field_name ];
-       if ( is_array( $script_handle ) ) {
-               if ( empty( $script_handle[ $index ] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $script_handle_or_path = $metadata[ $field_name ];
+       if ( is_array( $script_handle_or_path ) ) {
+               if ( empty( $script_handle_or_path[ $index ] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return false;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $script_handle = $script_handle[ $index ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $script_handle_or_path = $script_handle_or_path[ $index ];
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $script_path = remove_block_asset_path_prefix( $script_handle );
-       if ( $script_handle === $script_path ) {
-               return $script_handle;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $script_path = remove_block_asset_path_prefix( $script_handle_or_path );
+       if ( $script_handle_or_path === $script_path ) {
+               return $script_handle_or_path;
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $path                  = dirname( $metadata['file'] );
</span><span class="cx" style="display: block; padding: 0 10px">        $script_asset_raw_path = $path . '/' . substr_replace( $script_path, '.asset.php', - strlen( '.js' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $script_handle         = generate_block_asset_handle( $metadata['name'], $field_name, $index );
</del><span class="cx" style="display: block; padding: 0 10px">         $script_asset_path     = wp_normalize_path(
</span><span class="cx" style="display: block; padding: 0 10px">                realpath( $script_asset_raw_path )
</span><span class="cx" style="display: block; padding: 0 10px">        );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $script_path_norm = wp_normalize_path( realpath( $path . '/' . $script_path ) );
-       $script_uri       = get_block_asset_url( $script_path_norm );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Asset file for blocks is optional. See https://core.trac.wordpress.org/ticket/60460.
+       $script_asset = ! empty( $script_asset_path ) ? require $script_asset_path : array();
+       $script_handle = isset( $script_asset['handle'] ) ?
+               $script_asset['handle'] :
+               generate_block_asset_handle( $metadata['name'], $field_name, $index );
+       if ( wp_script_is( $script_handle, 'registered' ) ) {
+               return $script_handle;
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $script_args = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $script_path_norm    = wp_normalize_path( realpath( $path . '/' . $script_path ) );
+       $script_uri          = get_block_asset_url( $script_path_norm );
+       $script_dependencies = isset( $script_asset['dependencies'] ) ? $script_asset['dependencies'] : array();
+       $block_version       = isset( $metadata['version'] ) ? $metadata['version'] : false;
+       $script_version      = isset( $script_asset['version'] ) ? $script_asset['version'] : $block_version;
+       $script_args         = array();
</ins><span class="cx" style="display: block; padding: 0 10px">         if ( 'viewScript' === $field_name && $script_uri ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $script_args['strategy'] = 'defer';
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        // Asset file for blocks is optional. See https://core.trac.wordpress.org/ticket/60460.
-       $script_asset        = ! empty( $script_asset_path ) ? require $script_asset_path : array();
-       $script_dependencies = isset( $script_asset['dependencies'] ) ? $script_asset['dependencies'] : array();
-       $result              = wp_register_script(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $result = wp_register_script(
</ins><span class="cx" style="display: block; padding: 0 10px">                 $script_handle,
</span><span class="cx" style="display: block; padding: 0 10px">                $script_uri,
</span><span class="cx" style="display: block; padding: 0 10px">                $script_dependencies,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                isset( $script_asset['version'] ) ? $script_asset['version'] : false,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $script_version,
</ins><span class="cx" style="display: block; padding: 0 10px">                 $script_args
</span><span class="cx" style="display: block; padding: 0 10px">        );
</span><span class="cx" style="display: block; padding: 0 10px">        if ( ! $result ) {
</span></span></pre></div>
<a id="trunktestsphpunitdatablocksnoticesharedscriptassetphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/blocks/notice/shared-script.asset.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/blocks/notice/shared-script.asset.php                            (rev 0)
+++ trunk/tests/phpunit/data/blocks/notice/shared-script.asset.php      2024-02-12 11:40:49 UTC (rev 57590)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,7 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+return array(
+       'handle'       => 'tests-my-shared-script',
+       'dependencies' => array(),
+       'version'      => 'test',
+);
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/blocks/notice/shared-script.asset.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatablocksnoticesharedscriptjs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/blocks/notice/shared-script.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/blocks/notice/shared-script.js                           (rev 0)
+++ trunk/tests/phpunit/data/blocks/notice/shared-script.js     2024-02-12 11:40:49 UTC (rev 57590)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* Another test JavaScript file. */
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/blocks/notice/shared-script.js
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunittestsblocksregisterphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/blocks/register.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/blocks/register.php     2024-02-12 11:31:27 UTC (rev 57589)
+++ trunk/tests/phpunit/tests/blocks/register.php       2024-02-12 11:40:49 UTC (rev 57590)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -52,16 +52,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 5.0.0
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function tear_down() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $registry = WP_Block_Type_Registry::get_instance();
-
-               foreach ( array( 'core/test-static', 'core/test-dynamic', 'tests/notice' ) as $block_name ) {
-                       if ( $registry->is_registered( $block_name ) ) {
-                               $registry->unregister( $block_name );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Removes test block types registered by test cases.
+               $block_types = WP_Block_Type_Registry::get_instance()->get_all_registered();
+               foreach ( $block_types as $block_type ) {
+                       $block_name = $block_type->name;
+                       if ( str_starts_with( $block_name, 'tests/' ) ) {
+                               unregister_block_type( $block_name );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                foreach ( wp_scripts()->registered as $script_handle => $script ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( str_starts_with( $script_handle, 'unit-tests-' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( str_starts_with( $script_handle, 'tests-' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 wp_deregister_script( $script_handle );
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -82,7 +83,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 45109
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_register_affects_main_registry() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $name     = 'core/test-static';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $name     = 'tests/static';
</ins><span class="cx" style="display: block; padding: 0 10px">                 $settings = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'icon' => 'text',
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -97,7 +98,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 45109
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_unregister_affects_main_registry() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $name     = 'core/test-static';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $name     = 'tests/static';
</ins><span class="cx" style="display: block; padding: 0 10px">                 $settings = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'icon' => 'text',
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -141,43 +142,43 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 60233
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_generate_block_asset_handle() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $block_name = 'unit-tests/my-block';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $block_name = 'tests/my-block';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'unit-tests-my-block-editor-script',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'tests-my-block-editor-script',
</ins><span class="cx" style="display: block; padding: 0 10px">                         generate_block_asset_handle( $block_name, 'editorScript' )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'unit-tests-my-block-script',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'tests-my-block-script',
</ins><span class="cx" style="display: block; padding: 0 10px">                         generate_block_asset_handle( $block_name, 'script', 0 )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'unit-tests-my-block-view-script-100',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'tests-my-block-view-script-100',
</ins><span class="cx" style="display: block; padding: 0 10px">                         generate_block_asset_handle( $block_name, 'viewScript', 99 )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'unit-tests-my-block-view-script-module',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'tests-my-block-view-script-module',
</ins><span class="cx" style="display: block; padding: 0 10px">                         generate_block_asset_handle( $block_name, 'viewScriptModule' )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'unit-tests-my-block-view-script-module-2',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'tests-my-block-view-script-module-2',
</ins><span class="cx" style="display: block; padding: 0 10px">                         generate_block_asset_handle( $block_name, 'viewScriptModule', 1 )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'unit-tests-my-block-view-script-module-100',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'tests-my-block-view-script-module-100',
</ins><span class="cx" style="display: block; padding: 0 10px">                         generate_block_asset_handle( $block_name, 'viewScriptModule', 99 )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'unit-tests-my-block-editor-style-2',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'tests-my-block-editor-style-2',
</ins><span class="cx" style="display: block; padding: 0 10px">                         generate_block_asset_handle( $block_name, 'editorStyle', 1 )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'unit-tests-my-block-style',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'tests-my-block-style',
</ins><span class="cx" style="display: block; padding: 0 10px">                         generate_block_asset_handle( $block_name, 'style' )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                // @ticket 59673
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'unit-tests-my-block-view-style',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'tests-my-block-view-style',
</ins><span class="cx" style="display: block; padding: 0 10px">                         generate_block_asset_handle( $block_name, 'viewStyle' ),
</span><span class="cx" style="display: block; padding: 0 10px">                        'asset handle for viewStyle is not generated correctly'
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -335,12 +336,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_missing_asset_file_register_block_script_module_id() {
</span><span class="cx" style="display: block; padding: 0 10px">                $metadata = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'file'             => __FILE__,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'name'             => 'unit-tests/test-block',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'name'             => 'tests/test-block',
</ins><span class="cx" style="display: block; padding: 0 10px">                         'viewScriptModule' => 'file:./blocks/notice/missing-asset.js',
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $result   = register_block_script_module_id( $metadata, 'viewScriptModule' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame( 'unit-tests-test-block-view-script-module', $result );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSame( 'tests-test-block-view-script-module', $result );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -376,14 +377,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_success_register_block_script_module_id() {
</span><span class="cx" style="display: block; padding: 0 10px">                $metadata = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'file'             => DIR_TESTDATA . '/blocks/notice/block.json',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'name'             => 'unit-tests/test-block',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'name'             => 'tests/test-block',
</ins><span class="cx" style="display: block; padding: 0 10px">                         'viewScriptModule' => 'file:./block.js',
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $result   = register_block_script_module_id( $metadata, 'viewScriptModule' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame( 'unit-tests-test-block-view-script-module', $result );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSame( 'tests-test-block-view-script-module', $result );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Test the behavior directly within the unit test
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Test the behavior directly within the unit test.
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertFalse(
</span><span class="cx" style="display: block; padding: 0 10px">                        strpos(
</span><span class="cx" style="display: block; padding: 0 10px">                                wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $metadata['viewScriptModule'] ) ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -430,12 +431,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_missing_asset_file_register_block_script_handle_with_default_settings() {
</span><span class="cx" style="display: block; padding: 0 10px">                $metadata = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'file'   => __FILE__,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'name'   => 'unit-tests/test-block',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'name'   => 'tests/test-block',
</ins><span class="cx" style="display: block; padding: 0 10px">                         'script' => 'file:./blocks/notice/missing-asset.js',
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $result   = register_block_script_handle( $metadata, 'script' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame( 'unit-tests-test-block-script', $result );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSame( 'tests-test-block-script', $result );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -444,14 +445,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_success_register_block_script_handle() {
</span><span class="cx" style="display: block; padding: 0 10px">                $metadata = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'file'   => DIR_TESTDATA . '/blocks/notice/block.json',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'name'   => 'unit-tests/test-block',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'name'   => 'tests/test-block',
</ins><span class="cx" style="display: block; padding: 0 10px">                         'script' => 'file:./block.js',
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $result   = register_block_script_handle( $metadata, 'script' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame( 'unit-tests-test-block-script', $result );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSame( 'tests-test-block-script', $result );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Test the behavior directly within the unit test
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Test the behavior directly within the unit test.
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertFalse(
</span><span class="cx" style="display: block; padding: 0 10px">                        strpos(
</span><span class="cx" style="display: block; padding: 0 10px">                                wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $metadata['script'] ) ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -468,6 +469,51 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 60485
+        */
+       public function test_success_register_block_script_handle_with_custom_handle_name() {
+               $custom_script_handle = 'tests-my-shared-script';
+               $metadata             = array(
+                       'file'   => DIR_TESTDATA . '/blocks/notice/block.json',
+                       'name'   => 'tests/sample-block',
+                       'script' => 'file:./shared-script.js',
+               );
+               $result               = register_block_script_handle( $metadata, 'script' );
+
+               $this->assertSame( $custom_script_handle, $result );
+               $this->assertStringEndsWith(
+                       'shared-script.js',
+                       wp_scripts()->registered[ $custom_script_handle ]->src
+               );
+       }
+
+       /**
+        * @ticket 60485
+        */
+       public function test_reuse_registered_block_script_handle_with_custom_handle_name() {
+               $custom_script_handle = 'tests-my-shared-script';
+               $custom_script_src    = 'https://example.com/foo.js';
+               wp_register_script( $custom_script_handle, $custom_script_src );
+
+               $this->assertTrue(
+                       wp_script_is( $custom_script_handle, 'registered' )
+               );
+
+               $metadata = array(
+                       'file'   => DIR_TESTDATA . '/blocks/notice/block.json',
+                       'name'   => 'tests/sample-block',
+                       'script' => 'file:./shared-script.js',
+               );
+               $result   = register_block_script_handle( $metadata, 'script' );
+
+               $this->assertSame( $custom_script_handle, $result );
+               $this->assertSame(
+                       $custom_script_src,
+                       wp_scripts()->registered[ $custom_script_handle ]->src
+               );
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * @ticket 55513
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_success_register_block_script_handle_in_theme() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -620,33 +666,33 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_success_register_block_style_handle() {
</span><span class="cx" style="display: block; padding: 0 10px">                $metadata = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'file'      => DIR_TESTDATA . '/blocks/notice/block.json',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'name'      => 'unit-tests/test-block',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'name'      => 'tests/test-block',
</ins><span class="cx" style="display: block; padding: 0 10px">                         'style'     => 'file:./block.css',
</span><span class="cx" style="display: block; padding: 0 10px">                        'viewStyle' => 'file:./block-view.css',
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $result   = register_block_style_handle( $metadata, 'style' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame( 'unit-tests-test-block-style', $result );
-               $this->assertFalse( wp_styles()->get_data( 'unit-tests-test-block-style', 'rtl' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSame( 'tests-test-block-style', $result );
+               $this->assertFalse( wp_styles()->get_data( 'tests-test-block-style', 'rtl' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // @ticket 50328
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_normalize_path( realpath( DIR_TESTDATA . '/blocks/notice/block.css' ) ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        wp_normalize_path( wp_styles()->get_data( 'unit-tests-test-block-style', 'path' ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 wp_normalize_path( wp_styles()->get_data( 'tests-test-block-style', 'path' ) )
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Test viewStyle property
</span><span class="cx" style="display: block; padding: 0 10px">                $result = register_block_style_handle( $metadata, 'viewStyle' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertSame( 'unit-tests-test-block-view-style', $result );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertSame( 'tests-test-block-view-style', $result );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // @ticket 59673
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_normalize_path( realpath( DIR_TESTDATA . '/blocks/notice/block-view.css' ) ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        wp_normalize_path( wp_styles()->get_data( 'unit-tests-test-block-view-style', 'path' ) ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 wp_normalize_path( wp_styles()->get_data( 'tests-test-block-view-style', 'path' ) ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         'viewStyle asset path is not correct'
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // Test the behavior directly within the unit test
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Test the behavior directly within the unit test.
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertFalse(
</span><span class="cx" style="display: block; padding: 0 10px">                        strpos(
</span><span class="cx" style="display: block; padding: 0 10px">                                wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $metadata['style'] ) ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -675,7 +721,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $metadata = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'file'  => DIR_TESTDATA . '/blocks/notice/block.json',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'name'  => 'unit-tests/test-block-rtl',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'name'  => 'tests/test-block-rtl',
</ins><span class="cx" style="display: block; padding: 0 10px">                         'style' => 'file:./block.css',
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -683,14 +729,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $wp_locale->text_direction = 'rtl';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $handle       = register_block_style_handle( $metadata, 'style' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $extra_rtl    = wp_styles()->get_data( 'unit-tests-test-block-rtl-style', 'rtl' );
-               $extra_suffix = wp_styles()->get_data( 'unit-tests-test-block-rtl-style', 'suffix' );
-               $extra_path   = wp_normalize_path( wp_styles()->get_data( 'unit-tests-test-block-rtl-style', 'path' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $extra_rtl    = wp_styles()->get_data( 'tests-test-block-rtl-style', 'rtl' );
+               $extra_suffix = wp_styles()->get_data( 'tests-test-block-rtl-style', 'suffix' );
+               $extra_path   = wp_normalize_path( wp_styles()->get_data( 'tests-test-block-rtl-style', 'path' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $wp_locale->text_direction = $orig_text_dir;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'unit-tests-test-block-rtl-style',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'tests-test-block-rtl-style',
</ins><span class="cx" style="display: block; padding: 0 10px">                         $handle,
</span><span class="cx" style="display: block; padding: 0 10px">                        'The handle did not match the expected handle.'
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -720,13 +766,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_register_nonexistent_stylesheet() {
</span><span class="cx" style="display: block; padding: 0 10px">                $metadata = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'file'  => DIR_TESTDATA . '/blocks/notice/block.json',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        'name'  => 'unit-tests/test-block-nonexistent-stylesheet',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 'name'  => 'tests/test-block-nonexistent-stylesheet',
</ins><span class="cx" style="display: block; padding: 0 10px">                         'style' => 'file:./nonexistent.css',
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                register_block_style_handle( $metadata, 'style' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                global $wp_styles;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertFalse( $wp_styles->registered['unit-tests-test-block-nonexistent-stylesheet-style']->src );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertFalse( $wp_styles->registered['tests-test-block-nonexistent-stylesheet-style']->src );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1044,13 +1090,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                // @ticket 50328
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_normalize_path( realpath( DIR_TESTDATA . '/blocks/notice/block.css' ) ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        wp_normalize_path( wp_styles()->get_data( 'unit-tests-test-block-style', 'path' ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 wp_normalize_path( wp_styles()->get_data( 'tests-test-block-style', 'path' ) )
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // @ticket 59673
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame(
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_normalize_path( realpath( DIR_TESTDATA . '/blocks/notice/block-view.css' ) ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        wp_normalize_path( wp_styles()->get_data( 'unit-tests-test-block-view-style', 'path' ) ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 wp_normalize_path( wp_styles()->get_data( 'tests-test-block-view-style', 'path' ) ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         'viewStyle asset path is not correct'
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1089,10 +1135,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_register_block_type_accepts_editor_script_array( $editor_script, $expected ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $settings = array( 'editor_script' => $editor_script );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                register_block_type( 'core/test-static', $settings );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         register_block_type( 'tests/static', $settings );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $registry   = WP_Block_Type_Registry::get_instance();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $block_type = $registry->get_registered( 'core/test-static' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $block_type = $registry->get_registered( 'tests/static' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertObjectHasProperty( 'editor_script_handles', $block_type );
</span><span class="cx" style="display: block; padding: 0 10px">                $actual_script         = $block_type->editor_script;
</span><span class="cx" style="display: block; padding: 0 10px">                $actual_script_handles = $block_type->editor_script_handles;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1155,10 +1201,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_register_block_type_throws_doing_it_wrong( $editor_script, $expected ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $settings = array( 'editor_script' => $editor_script );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                register_block_type( 'core/test-static', $settings );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         register_block_type( 'tests/static', $settings );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $registry   = WP_Block_Type_Registry::get_instance();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $block_type = $registry->get_registered( 'core/test-static' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $block_type = $registry->get_registered( 'tests/static' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertObjectHasProperty( 'editor_script_handles', $block_type );
</span><span class="cx" style="display: block; padding: 0 10px">                $actual_script         = $block_type->editor_script;
</span><span class="cx" style="display: block; padding: 0 10px">                $actual_script_handles = $block_type->editor_script_handles;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1248,13 +1294,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 45109
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_get_dynamic_block_names() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                register_block_type( 'core/test-static', array() );
-               register_block_type( 'core/test-dynamic', array( 'render_callback' => array( $this, 'render_stub' ) ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         register_block_type( 'tests/static', array() );
+               register_block_type( 'tests/dynamic', array( 'render_callback' => array( $this, 'render_stub' ) ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $dynamic_block_names = get_dynamic_block_names();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertContains( 'core/test-dynamic', $dynamic_block_names );
-               $this->assertNotContains( 'core/test-static', $dynamic_block_names );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertContains( 'tests/dynamic', $dynamic_block_names );
+               $this->assertNotContains( 'tests/static', $dynamic_block_names );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span></span></pre>
</div>
</div>

</body>
</html>