<!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>[56759] trunk/tests/phpunit: Tests: Cover Block Hooks integration with a custom block theme</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/56759">56759</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/56759","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>2023-10-03 08:27:51 +0000 (Tue, 03 Oct 2023)</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'>Tests: Cover Block Hooks integration with a custom block theme
Adds a simplified version of Twenty Twenty-Three theme that helps testing Block Hooks integration. The theme contains:
- The required index.html template.
- The optional single.html template used with tests.
- 3 template parts where two of them reference patterns.
- 3 patterns referenced in the templates and the template parts.
New tests automatically register 4 custom blocks with the test theme where each of them hooks into another block using all four target relative positions: `before`, `after`, `firstChild`, `lastChild`.
The tests verify that the block gets hooked into the correct positions when targeting:
- template
- template part
- pattern
Props ockham, costdev.
See <a href="https://core.trac.wordpress.org/ticket/59313">#59313</a>, <a href="https://core.trac.wordpress.org/ticket/59383">#59383</a>.
Follow-up <a href="https://core.trac.wordpress.org/changeset/56610">[56610]</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsblocksblockHooksphp">trunk/tests/phpunit/tests/blocks/blockHooks.php</a></li>
<li><a href="#trunktestsphpunitteststhemethemeDirphp">trunk/tests/phpunit/tests/theme/themeDir.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/</li>
<li>trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/</li>
<li>trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-after/</li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedafterblockjson">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-after/block.json</a></li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedafterrenderphp">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-after/render.php</a></li>
<li>trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-before/</li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedbeforeblockjson">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-before/block.json</a></li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedbeforerenderphp">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-before/render.php</a></li>
<li>trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-first-child/</li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedfirstchildblockjson">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-first-child/block.json</a></li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedfirstchildrenderphp">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-first-child/render.php</a></li>
<li>trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-last-child/</li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedlastchildblockjson">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-last-child/block.json</a></li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedlastchildrenderphp">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-last-child/render.php</a></li>
<li>trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/parts/</li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblockspartscommentshtml">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/parts/comments.html</a></li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblockspartsfooterhtml">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/parts/footer.html</a></li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblockspartsheaderhtml">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/parts/header.html</a></li>
<li>trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/patterns/</li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblockspatternsfooterdefaultphp">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/patterns/footer-default.php</a></li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblockspatternshiddencommentsphp">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/patterns/hidden-comments.php</a></li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblockspatternspostmetaphp">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/patterns/post-meta.php</a></li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblocksstylecss">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/style.css</a></li>
<li>trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/templates/</li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblockstemplatesindexhtml">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/templates/index.html</a></li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblockstemplatessinglehtml">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/templates/single.html</a></li>
<li><a href="#trunktestsphpunitdatathemedir1blockthemewithhookedblocksthemejson">trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/theme.json</a></li>
<li><a href="#trunktestsphpunittestsblocksgetHookedBlocksphp">trunk/tests/phpunit/tests/blocks/getHookedBlocks.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedafterblockjson"></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/themedir1/block-theme-with-hooked-blocks/blocks/hooked-after/block.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-after/block.json (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-after/block.json 2023-10-03 08:27:51 UTC (rev 56759)
</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">+{
+ "name": "tests/hooked-after",
+ "blockHooks": {
+ "core/post-content": "after"
+ },
+ "render": "file:render.php"
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-after/block.json
</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="trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedafterrenderphp"></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/themedir1/block-theme-with-hooked-blocks/blocks/hooked-after/render.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-after/render.php (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-after/render.php 2023-10-03 08:27:51 UTC (rev 56759)
</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">+<p>Block hooked after.<p>
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-after/render.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="trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedbeforeblockjson"></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/themedir1/block-theme-with-hooked-blocks/blocks/hooked-before/block.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-before/block.json (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-before/block.json 2023-10-03 08:27:51 UTC (rev 56759)
</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">+{
+ "name": "tests/hooked-before",
+ "blockHooks": {
+ "core/navigation": "before"
+ },
+ "render": "file:render.php"
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-before/block.json
</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="trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedbeforerenderphp"></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/themedir1/block-theme-with-hooked-blocks/blocks/hooked-before/render.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-before/render.php (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-before/render.php 2023-10-03 08:27:51 UTC (rev 56759)
</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">+<p>Block hooked before.<p>
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-before/render.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="trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedfirstchildblockjson"></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/themedir1/block-theme-with-hooked-blocks/blocks/hooked-first-child/block.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-first-child/block.json (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-first-child/block.json 2023-10-03 08:27:51 UTC (rev 56759)
</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">+{
+ "name": "tests/hooked-first-child",
+ "blockHooks": {
+ "core/comments": "firstChild"
+ },
+ "render": "file:render.php"
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-first-child/block.json
</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="trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedfirstchildrenderphp"></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/themedir1/block-theme-with-hooked-blocks/blocks/hooked-first-child/render.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-first-child/render.php (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-first-child/render.php 2023-10-03 08:27:51 UTC (rev 56759)
</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">+<p>Block hooked as the first child.<p>
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-first-child/render.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="trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedlastchildblockjson"></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/themedir1/block-theme-with-hooked-blocks/blocks/hooked-last-child/block.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-last-child/block.json (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-last-child/block.json 2023-10-03 08:27:51 UTC (rev 56759)
</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">+{
+ "name": "tests/hooked-last-child",
+ "blockHooks": {
+ "core/comment-template": "lastChild"
+ },
+ "render": "file:render.php"
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-last-child/block.json
</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="trunktestsphpunitdatathemedir1blockthemewithhookedblocksblockshookedlastchildrenderphp"></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/themedir1/block-theme-with-hooked-blocks/blocks/hooked-last-child/render.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-last-child/render.php (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-last-child/render.php 2023-10-03 08:27:51 UTC (rev 56759)
</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">+<p>Block hooked as the last child.<p>
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/blocks/hooked-last-child/render.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="trunktestsphpunitdatathemedir1blockthemewithhookedblockspartscommentshtml"></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/themedir1/block-theme-with-hooked-blocks/parts/comments.html</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/parts/comments.html (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/parts/comments.html 2023-10-03 08:27:51 UTC (rev 56759)
</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">+<!-- wp:pattern {"slug":"block-theme-with-hooked-blocks/hidden-comments"} /-->
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/parts/comments.html
</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="trunktestsphpunitdatathemedir1blockthemewithhookedblockspartsfooterhtml"></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/themedir1/block-theme-with-hooked-blocks/parts/footer.html</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/parts/footer.html (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/parts/footer.html 2023-10-03 08:27:51 UTC (rev 56759)
</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">+<!-- wp:pattern {"slug":"block-theme-with-hooked-blocks/footer-default"} /-->
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/parts/footer.html
</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="trunktestsphpunitdatathemedir1blockthemewithhookedblockspartsheaderhtml"></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/themedir1/block-theme-with-hooked-blocks/parts/header.html</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/parts/header.html (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/parts/header.html 2023-10-03 08:27:51 UTC (rev 56759)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,10 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<!-- wp:group {"layout":{"type":"constrained"}} -->
+<div class="wp-block-group">
+ <!-- wp:group {"align":"wide","layout":{"type":"flex","justifyContent":"space-between"}} -->
+ <div class="wp-block-group alignwide">
+ <!-- wp:site-title {"level":0} /-->
+ <!-- wp:navigation {"layout":{"type":"flex","setCascadingProperties":true,"justifyContent":"right"}} /-->
+ </div>
+ <!-- /wp:group -->
+</div>
+<!-- /wp:group -->
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/parts/header.html
</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="trunktestsphpunitdatathemedir1blockthemewithhookedblockspatternsfooterdefaultphp"></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/themedir1/block-theme-with-hooked-blocks/patterns/footer-default.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/patterns/footer-default.php (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/patterns/footer-default.php 2023-10-03 08:27:51 UTC (rev 56759)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,28 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Title: Default Footer
+ * Slug: block-theme-with-hooked-blocks/footer-default
+ * Categories: footer
+ * Block Types: core/template-part/footer
+ */
+?>
+<!-- wp:group {"layout":{"type":"constrained"}} -->
+<div class="wp-block-group">
+ <!-- wp:group {"align":"wide","layout":{"type":"flex","justifyContent":"space-between"}} -->
+ <div class="wp-block-group alignwide">
+ <!-- wp:site-title {"level":0} /-->
+ <!-- wp:paragraph {"align":"right"} -->
+ <p class="has-text-align-right">
+ <?php
+ printf(
+ /* Translators: WordPress link. */
+ esc_html__( 'Proudly powered by %s', 'block-theme-with-hooked-blocks' ),
+ '<a href="' . esc_url( __( 'https://wordpress.org', 'block-theme-with-hooked-blocks' ) ) . '" rel="nofollow">WordPress</a>'
+ )
+ ?>
+ </p>
+ <!-- /wp:paragraph -->
+ </div>
+ <!-- /wp:group -->
+</div>
+<!-- /wp:group -->
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/patterns/footer-default.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="trunktestsphpunitdatathemedir1blockthemewithhookedblockspatternshiddencommentsphp"></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/themedir1/block-theme-with-hooked-blocks/patterns/hidden-comments.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/patterns/hidden-comments.php (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/patterns/hidden-comments.php 2023-10-03 08:27:51 UTC (rev 56759)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,57 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Title: Hidden Comments
+ * Slug: block-theme-with-hooked-blocks/hidden-comments
+ * Inserter: no
+ */
+?>
+<!-- wp:group {"layout":{"type":"constrained"}} -->
+<div class="wp-block-group" >
+ <!-- wp:comments -->
+ <div class="wp-block-comments">
+ <!-- wp:heading {"level":2} -->
+ <h2><?php echo esc_html_x( 'Comments', 'Title of comments section', 'block-theme-with-hooked-blocks' ); ?></h2>
+ <!-- /wp:heading -->
+
+ <!-- wp:comments-title {"level":3} /-->
+
+ <!-- wp:comment-template -->
+ <!-- wp:columns -->
+ <div class="wp-block-columns">
+ <!-- wp:column -->
+ <div class="wp-block-column">
+ <!-- wp:avatar /-->
+ </div>
+ <!-- /wp:column -->
+
+ <!-- wp:column -->
+ <div class="wp-block-column">
+ <!-- wp:comment-author-name /-->
+
+ <!-- wp:group -->
+ <div class="wp-block-group">
+ <!-- wp:comment-date /-->
+ <!-- wp:comment-edit-link /-->
+ </div>
+ <!-- /wp:group -->
+
+ <!-- wp:comment-content /-->
+
+ <!-- wp:comment-reply-link /-->
+ </div>
+ <!-- /wp:column -->
+ </div>
+ <!-- /wp:columns -->
+ <!-- /wp:comment-template -->
+
+ <!-- wp:comments-pagination {"paginationArrow":"arrow","layout":{"type":"flex","justifyContent":"space-between"}} -->
+ <!-- wp:comments-pagination-previous /-->
+ <!-- wp:comments-pagination-numbers /-->
+ <!-- wp:comments-pagination-next /-->
+ <!-- /wp:comments-pagination -->
+
+ <!-- wp:post-comments-form /-->
+ </div>
+ <!-- /wp:comments -->
+</div>
+<!-- /wp:group -->
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/patterns/hidden-comments.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="trunktestsphpunitdatathemedir1blockthemewithhookedblockspatternspostmetaphp"></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/themedir1/block-theme-with-hooked-blocks/patterns/post-meta.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/patterns/post-meta.php (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/patterns/post-meta.php 2023-10-03 08:27:51 UTC (rev 56759)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,76 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Title: Post Meta
+ * Slug: block-theme-with-hooked-blocks/post-meta
+ * Categories: query
+ * Keywords: post meta
+ * Block Types: core/template-part/post-meta
+ */
+?>
+<!-- wp:spacer {"height":"0"} -->
+<div style="height:0" aria-hidden="true" class="wp-block-spacer"></div>
+<!-- /wp:spacer -->
+
+<!-- wp:group {"layout":{"type":"constrained"}} -->
+<div class="wp-block-group">
+ <!-- wp:separator {"opacity":"css","align":"wide","className":"is-style-wide"} -->
+ <hr class="wp-block-separator alignwide has-css-opacity is-style-wide"/>
+ <!-- /wp:separator -->
+
+ <!-- wp:columns -->
+ <div class="wp-block-columns">
+ <!-- wp:column -->
+ <div class="wp-block-column">
+ <!-- wp:group {"layout":{"type":"flex"}} -->
+ <div class="wp-block-group">
+ <!-- wp:paragraph -->
+ <p>
+ <?php echo esc_html_x( 'Posted', 'Verb to explain the publication status of a post', 'block-theme-with-hooked-blocks' ); ?>
+ </p>
+ <!-- /wp:paragraph -->
+
+ <!-- wp:post-date /-->
+
+ <!-- wp:paragraph -->
+ <p>
+ <?php echo esc_html_x( 'in', 'Preposition to show the relationship between the post and its categories', 'block-theme-with-hooked-blocks' ); ?>
+ </p>
+ <!-- /wp:paragraph -->
+
+ <!-- wp:post-terms {"term":"category"} /-->
+ </div>
+ <!-- /wp:group -->
+
+ <!-- wp:group {"layout":{"type":"flex"}} -->
+ <div class="wp-block-group">
+ <!-- wp:paragraph -->
+ <p>
+ <?php echo esc_html_x( 'by', 'Preposition to show the relationship between the post and its author', 'block-theme-with-hooked-blocks' ); ?>
+ </p>
+ <!-- /wp:paragraph -->
+
+ <!-- wp:post-author {"showAvatar":false} /-->
+ </div>
+ <!-- /wp:group -->
+ </div>
+ <!-- /wp:column -->
+
+ <!-- wp:column -->
+ <div class="wp-block-column">
+ <!-- wp:group {"layout":{"type":"flex","orientation":"vertical"}} -->
+ <div class="wp-block-group">
+ <!-- wp:paragraph -->
+ <p>
+ <?php echo esc_html_x( 'Tags:', 'Label for a list of post tags', 'block-theme-with-hooked-blocks' ); ?>
+ </p>
+ <!-- /wp:paragraph -->
+
+ <!-- wp:post-terms {"term":"post_tag"} /-->
+ </div>
+ <!-- /wp:group -->
+ </div>
+ <!-- /wp:column -->
+ </div>
+ <!-- /wp:columns -->
+</div>
+<!-- /wp:group -->
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/patterns/post-meta.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="trunktestsphpunitdatathemedir1blockthemewithhookedblocksstylecss"></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/themedir1/block-theme-with-hooked-blocks/style.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/style.css (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/style.css 2023-10-03 08:27:51 UTC (rev 56759)
</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">+/*
+Theme Name: Block Theme with Hooked Blocks
+Theme URI: https://wordpress.org/
+Description: For testing purposes only.
+Version: 1.0.0
+Text Domain: block-theme-with-hooked-blocks
+*/
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/style.css
</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="trunktestsphpunitdatathemedir1blockthemewithhookedblockstemplatesindexhtml"></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/themedir1/block-theme-with-hooked-blocks/templates/index.html</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/templates/index.html (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/templates/index.html 2023-10-03 08:27:51 UTC (rev 56759)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,23 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
+
+<!-- wp:group {"tagName":"main","layout":{"type":"constrained"}} -->
+<main class="wp-block-group">
+ <!-- wp:query {"query":{"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true,"taxQuery":null,"parents":[]},"displayLayout":{"type":"flex","columns":3},"align":"wide","layout":{"type":"default"}} -->
+ <div class="wp-block-query alignwide">
+ <!-- wp:post-template {"align":"wide"} -->
+ <!-- wp:post-featured-image {"isLink":true,"width":"100%","height":"clamp(15vw, 30vh, 400px)","align":"wide"} /-->
+ <!-- wp:post-title {"isLink":true,"align":"wide"} /-->
+ <!-- wp:post-excerpt /-->
+ <!-- wp:post-date {"isLink":true} /-->
+ <!-- /wp:post-template -->
+
+ <!-- wp:query-pagination {"paginationArrow":"arrow","align":"wide","layout":{"type":"flex","justifyContent":"space-between"}} -->
+ <!-- wp:query-pagination-previous /-->
+ <!-- wp:query-pagination-next /-->
+ <!-- /wp:query-pagination -->
+ </div>
+ <!-- /wp:query -->
+</main>
+<!-- /wp:group -->
+
+<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/templates/index.html
</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="trunktestsphpunitdatathemedir1blockthemewithhookedblockstemplatessinglehtml"></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/themedir1/block-theme-with-hooked-blocks/templates/single.html</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/templates/single.html (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/templates/single.html 2023-10-03 08:27:51 UTC (rev 56759)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,18 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
+
+<!-- wp:group {"tagName":"main"} -->
+<main class="wp-block-group">
+ <!-- wp:group {"layout":{"type":"constrained"}} -->
+ <div class="wp-block-group">
+ <!-- wp:post-featured-image /-->
+ <!-- wp:post-title /-->
+ </div>
+ <!-- /wp:group -->
+
+ <!-- wp:post-content {"layout":{"type":"constrained"}} /-->
+ <!-- wp:pattern {"slug":"block-theme-with-hooked-blocks/post-meta"} /-->
+ <!-- wp:template-part {"slug":"comments","tagName":"section"} /-->
+</main>
+<!-- /wp:group -->
+
+<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/templates/single.html
</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="trunktestsphpunitdatathemedir1blockthemewithhookedblocksthemejson"></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/themedir1/block-theme-with-hooked-blocks/theme.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/theme.json (rev 0)
+++ trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/theme.json 2023-10-03 08:27:51 UTC (rev 56759)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,21 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+{
+ "$schema": "https://schemas.wp.org/trunk/theme.json",
+ "version": 2,
+ "templateParts": [
+ {
+ "area": "header",
+ "name": "header",
+ "title": "Header"
+ },
+ {
+ "area": "footer",
+ "name": "footer",
+ "title": "Footer"
+ },
+ {
+ "area": "uncategorized",
+ "name": "comments",
+ "title": "Comments"
+ }
+ ]
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/block-theme-with-hooked-blocks/theme.json
</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="trunktestsphpunittestsblocksblockHooksphp"></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/blockHooks.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/blocks/blockHooks.php 2023-10-02 22:54:29 UTC (rev 56758)
+++ trunk/tests/phpunit/tests/blocks/blockHooks.php 2023-10-03 08:27:51 UTC (rev 56759)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,122 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Tests for block hooks feature functions.
- *
- * @package WordPress
- * @subpackage Blocks
- *
- * @since 6.4.0
- *
- * @group blocks
- */
-class Tests_Blocks_BlockHooks extends WP_UnitTestCase {
-
- /**
- * Tear down after each test.
- *
- * @since 6.4.0
- */
- public function tear_down() {
- $registry = WP_Block_Type_Registry::get_instance();
-
- foreach ( array( 'tests/my-block', 'tests/my-container-block' ) as $block_name ) {
- if ( $registry->is_registered( $block_name ) ) {
- $registry->unregister( $block_name );
- }
- }
-
- parent::tear_down();
- }
-
- /**
- * @ticket 59383
- *
- * @covers ::get_hooked_blocks
- */
- public function test_get_hooked_blocks_no_match_found() {
- $result = get_hooked_blocks( 'tests/no-hooked-blocks' );
-
- $this->assertSame( array(), $result );
- }
-
- /**
- * @ticket 59383
- *
- * @covers ::get_hooked_blocks
- */
- public function test_get_hooked_blocks_matches_found() {
- register_block_type(
- 'tests/injected-one',
- array(
- 'block_hooks' => array(
- 'tests/hooked-at-before' => 'before',
- 'tests/hooked-at-after' => 'after',
- 'tests/hooked-at-before-and-after' => 'before',
- ),
- )
- );
- register_block_type(
- 'tests/injected-two',
- array(
- 'block_hooks' => array(
- 'tests/hooked-at-before' => 'before',
- 'tests/hooked-at-after' => 'after',
- 'tests/hooked-at-before-and-after' => 'after',
- 'tests/hooked-at-first-child' => 'first_child',
- 'tests/hooked-at-last-child' => 'last_child',
- ),
- )
- );
-
- $this->assertSame(
- array(
- 'before' => array(
- 'tests/injected-one',
- 'tests/injected-two',
- ),
- ),
- get_hooked_blocks( 'tests/hooked-at-before' ),
- 'block hooked at the before position'
- );
- $this->assertSame(
- array(
- 'after' => array(
- 'tests/injected-one',
- 'tests/injected-two',
- ),
- ),
- get_hooked_blocks( 'tests/hooked-at-after' ),
- 'block hooked at the after position'
- );
- $this->assertSame(
- array(
- 'first_child' => array(
- 'tests/injected-two',
- ),
- ),
- get_hooked_blocks( 'tests/hooked-at-first-child' ),
- 'block hooked at the first child position'
- );
- $this->assertSame(
- array(
- 'last_child' => array(
- 'tests/injected-two',
- ),
- ),
- get_hooked_blocks( 'tests/hooked-at-last-child' ),
- 'block hooked at the last child position'
- );
- $this->assertSame(
- array(
- 'before' => array(
- 'tests/injected-one',
- ),
- 'after' => array(
- 'tests/injected-two',
- ),
- ),
- get_hooked_blocks( 'tests/hooked-at-before-and-after' ),
- 'block hooked before one block and after another'
- );
- }
-}
</del></span></pre></div>
<a id="trunktestsphpunittestsblocksgetHookedBlocksphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/tests/blocks/getHookedBlocks.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/blocks/getHookedBlocks.php (rev 0)
+++ trunk/tests/phpunit/tests/blocks/getHookedBlocks.php 2023-10-03 08:27:51 UTC (rev 56759)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,244 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Tests for the features using get_hooked_blocks function.
+ *
+ * @package WordPress
+ * @subpackage Blocks
+ *
+ * @since 6.4.0
+ *
+ * @group blocks
+ * @group block-hooks
+ */
+class Tests_Blocks_GetHookedBlocks extends WP_UnitTestCase {
+
+ const TEST_THEME_NAME = 'block-theme-with-hooked-blocks';
+
+ /**
+ * Tear down after each test.
+ *
+ * @since 6.4.0
+ */
+ public function tear_down() {
+ // 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 );
+ }
+ }
+
+ // Removes test block patterns registered with the test theme.
+ $patterns = WP_Block_Patterns_Registry::get_instance()->get_all_registered();
+ foreach ( $patterns as $pattern ) {
+ if ( empty( $pattern['slug'] ) ) {
+ continue;
+ }
+ $pattern_name = $pattern['slug'];
+ if ( str_starts_with( $pattern_name, self::TEST_THEME_NAME ) ) {
+ unregister_block_pattern( $pattern_name );
+ }
+ }
+
+ parent::tear_down();
+ }
+
+ private function switch_to_block_theme_hooked_blocks() {
+ switch_theme( self::TEST_THEME_NAME );
+
+ _register_theme_block_patterns();
+
+ $theme_blocks_dir = wp_normalize_path( realpath( get_theme_file_path( 'blocks' ) ) );
+ register_block_type( $theme_blocks_dir . '/hooked-before' );
+ register_block_type( $theme_blocks_dir . '/hooked-after' );
+ register_block_type( $theme_blocks_dir . '/hooked-first-child' );
+ register_block_type( $theme_blocks_dir . '/hooked-last-child' );
+ }
+
+ /**
+ * @ticket 59383
+ *
+ * @covers ::get_hooked_blocks
+ */
+ public function test_get_hooked_blocks_no_match_found() {
+ $result = get_hooked_blocks( 'tests/no-hooked-blocks' );
+
+ $this->assertSame( array(), $result );
+ }
+
+ /**
+ * @ticket 59383
+ *
+ * @covers ::get_hooked_blocks
+ */
+ public function test_get_hooked_blocks_matches_found() {
+ register_block_type(
+ 'tests/injected-one',
+ array(
+ 'block_hooks' => array(
+ 'tests/hooked-at-before' => 'before',
+ 'tests/hooked-at-after' => 'after',
+ 'tests/hooked-at-before-and-after' => 'before',
+ ),
+ )
+ );
+ register_block_type(
+ 'tests/injected-two',
+ array(
+ 'block_hooks' => array(
+ 'tests/hooked-at-before' => 'before',
+ 'tests/hooked-at-after' => 'after',
+ 'tests/hooked-at-before-and-after' => 'after',
+ 'tests/hooked-at-first-child' => 'first_child',
+ 'tests/hooked-at-last-child' => 'last_child',
+ ),
+ )
+ );
+
+ $this->assertSame(
+ array(
+ 'before' => array(
+ 'tests/injected-one',
+ 'tests/injected-two',
+ ),
+ ),
+ get_hooked_blocks( 'tests/hooked-at-before' ),
+ 'block hooked at the before position'
+ );
+ $this->assertSame(
+ array(
+ 'after' => array(
+ 'tests/injected-one',
+ 'tests/injected-two',
+ ),
+ ),
+ get_hooked_blocks( 'tests/hooked-at-after' ),
+ 'block hooked at the after position'
+ );
+ $this->assertSame(
+ array(
+ 'first_child' => array(
+ 'tests/injected-two',
+ ),
+ ),
+ get_hooked_blocks( 'tests/hooked-at-first-child' ),
+ 'block hooked at the first child position'
+ );
+ $this->assertSame(
+ array(
+ 'last_child' => array(
+ 'tests/injected-two',
+ ),
+ ),
+ get_hooked_blocks( 'tests/hooked-at-last-child' ),
+ 'block hooked at the last child position'
+ );
+ $this->assertSame(
+ array(
+ 'before' => array(
+ 'tests/injected-one',
+ ),
+ 'after' => array(
+ 'tests/injected-two',
+ ),
+ ),
+ get_hooked_blocks( 'tests/hooked-at-before-and-after' ),
+ 'block hooked before one block and after another'
+ );
+ }
+
+ /**
+ * @ticket 59313
+ *
+ * @covers ::get_hooked_blocks
+ * @covers ::get_block_file_template
+ */
+ public function test_loading_template_with_hooked_blocks() {
+ $this->switch_to_block_theme_hooked_blocks();
+
+ $template = get_block_file_template( get_stylesheet() . '//single' );
+
+ $this->assertStringNotContainsString(
+ '<!-- wp:tests/hooked-before /-->',
+ $template->content
+ );
+ $this->assertStringContainsString(
+ '<!-- wp:post-content {"layout":{"type":"constrained"}} /-->'
+ . '<!-- wp:tests/hooked-after /-->',
+ $template->content
+ );
+ $this->assertStringNotContainsString(
+ '<!-- wp:tests/hooked-first-child /-->',
+ $template->content
+ );
+ $this->assertStringNotContainsString(
+ '<!-- wp:tests/hooked-last-child /-->',
+ $template->content
+ );
+ }
+
+ /**
+ * @ticket 59313
+ *
+ * @covers ::get_hooked_blocks
+ * @covers ::get_block_file_template
+ */
+ public function test_loading_template_part_with_hooked_blocks() {
+ $this->switch_to_block_theme_hooked_blocks();
+
+ $template = get_block_file_template( get_stylesheet() . '//header', 'wp_template_part' );
+
+ $this->assertStringContainsString(
+ '<!-- wp:tests/hooked-before /-->'
+ . '<!-- wp:navigation {"layout":{"type":"flex","setCascadingProperties":true,"justifyContent":"right"}} /-->',
+ $template->content
+ );
+ $this->assertStringNotContainsString(
+ '<!-- wp:tests/hooked-after /-->',
+ $template->content
+ );
+ $this->assertStringNotContainsString(
+ '<!-- wp:tests/hooked-first-child /-->',
+ $template->content
+ );
+ $this->assertStringNotContainsString(
+ '<!-- wp:tests/hooked-last-child /-->',
+ $template->content
+ );
+ }
+
+ /**
+ * @ticket 59313
+ *
+ * @covers ::get_hooked_blocks
+ * @covers WP_Block_Patterns_Registry::get_registered
+ */
+ public function test_loading_pattern_with_hooked_blocks() {
+ $this->switch_to_block_theme_hooked_blocks();
+
+ $pattern = WP_Block_Patterns_Registry::get_instance()->get_registered(
+ get_stylesheet() . '/hidden-comments'
+ );
+
+ $this->assertStringNotContainsString(
+ '<!-- wp:tests/hooked-before /-->',
+ $pattern['content']
+ );
+ $this->assertStringNotContainsString(
+ '<!-- wp:tests/hooked-after /-->',
+ $pattern['content']
+ );
+ $this->assertStringContainsString(
+ '<!-- wp:comments -->'
+ . '<div class="wp-block-comments">'
+ . '<!-- wp:tests/hooked-first-child /-->',
+ str_replace( array( "\n", "\t" ), '', $pattern['content'] )
+ );
+ $this->assertStringContainsString(
+ '<!-- wp:tests/hooked-last-child /-->'
+ . '<!-- /wp:comment-template -->',
+ str_replace( array( "\n", "\t" ), '', $pattern['content'] )
+ );
+ }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/tests/blocks/getHookedBlocks.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="trunktestsphpunitteststhemethemeDirphp"></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/theme/themeDir.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/theme/themeDir.php 2023-10-02 22:54:29 UTC (rev 56758)
+++ trunk/tests/phpunit/tests/theme/themeDir.php 2023-10-03 08:27:51 UTC (rev 56759)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -187,6 +187,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'Block Theme Deprecated Path',
</span><span class="cx" style="display: block; padding: 0 10px"> 'Block Theme Post Content Default',
</span><span class="cx" style="display: block; padding: 0 10px"> 'Block Theme with defined Typography Fonts',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'Block Theme with Hooked Blocks',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'Empty `fontFace` in theme.json - no webfonts defined',
</span><span class="cx" style="display: block; padding: 0 10px"> 'A theme with the Update URI header',
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span></span></pre>
</div>
</div>
</body>
</html>