<!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>[55992] trunk: REST API: return post modified datetime for Templates.</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/55992">55992</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/55992","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>isabel_brison</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-06-23 06:27:45 +0000 (Fri, 23 Jun 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'>REST API: return post modified datetime for Templates.

Adds a `modified` field to the template and template part objects in the rest response for `WP_REST_Templates_Controller`.

Props ramonopoly, andrewserong, mukesh27, timothyblynjacobs.
Fixes <a href="https://core.trac.wordpress.org/ticket/58540">#58540</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesblocktemplateutilsphp">trunk/src/wp-includes/block-template-utils.php</a></li>
<li><a href="#trunksrcwpincludesclasswpblocktemplatephp">trunk/src/wp-includes/class-wp-block-template.php</a></li>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswpresttemplatescontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php</a></li>
<li><a href="#trunktestsphpunittestsblocktemplateutilsphp">trunk/tests/phpunit/tests/block-template-utils.php</a></li>
<li><a href="#trunktestsphpunittestsrestapiwpRestTemplatesControllerphp">trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesblocktemplateutilsphp"></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/block-template-utils.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-template-utils.php    2023-06-22 22:35:44 UTC (rev 55991)
+++ trunk/src/wp-includes/block-template-utils.php      2023-06-23 06:27:45 UTC (rev 55992)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -542,6 +542,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * Builds a unified template object based on a theme file.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 5.9.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.3.0 Added `modified` property to template objects.
</ins><span class="cx" style="display: block; padding: 0 10px">  * @access private
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @param array  $template_file Theme file.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -564,6 +565,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        $template->status         = 'publish';
</span><span class="cx" style="display: block; padding: 0 10px">        $template->has_theme_file = true;
</span><span class="cx" style="display: block; padding: 0 10px">        $template->is_custom      = true;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        $template->modified       = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        if ( 'wp_template' === $template_type && isset( $default_template_types[ $template_file['slug'] ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $template->description = $default_template_types[ $template_file['slug'] ]['description'];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -743,6 +745,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * Builds a unified template object based a post Object.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 5.9.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.3.0 Added `modified` property to template objects.
</ins><span class="cx" style="display: block; padding: 0 10px">  * @access private
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @param WP_Post $post Template post.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -782,6 +785,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        $template->has_theme_file = $has_theme_file;
</span><span class="cx" style="display: block; padding: 0 10px">        $template->is_custom      = empty( $is_wp_suggestion );
</span><span class="cx" style="display: block; padding: 0 10px">        $template->author         = $post->post_author;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        $template->modified       = $post->post_modified;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        if ( 'wp_template' === $post->post_type && $has_theme_file && isset( $template_file['postTypes'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $template->post_types = $template_file['postTypes'];
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpblocktemplatephp"></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/class-wp-block-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-block-template.php 2023-06-22 22:35:44 UTC (rev 55991)
+++ trunk/src/wp-includes/class-wp-block-template.php   2023-06-23 06:27:45 UTC (rev 55992)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -146,4 +146,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @var string|null
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public $area;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       /**
+        * Modified.
+        *
+        * @since 6.3.0
+        * @var string|null
+        */
+       public $modified;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiendpointsclasswpresttemplatescontrollerphp"></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/rest-api/endpoints/class-wp-rest-templates-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php   2023-06-22 22:35:44 UTC (rev 55991)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php     2023-06-23 06:27:45 UTC (rev 55992)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -614,6 +614,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 5.8.0
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 5.9.0 Renamed `$template` to `$item` to match parent class for PHP 8 named parameter support.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @since 6.3.0 Added `modified` property to the response.
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param WP_Block_Template $item    Template instance.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param WP_REST_Request   $request Request object.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -708,6 +709,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $data['area'] = $template->area;
</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">+                if ( rest_is_field_included( 'modified', $fields ) ) {
+                       $data['modified'] = mysql_to_rfc3339( $template->modified );
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
</span><span class="cx" style="display: block; padding: 0 10px">                $data    = $this->add_additional_fields_to_object( $data, $request );
</span><span class="cx" style="display: block; padding: 0 10px">                $data    = $this->filter_response_by_context( $data, $context );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -926,6 +931,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        'type'        => 'integer',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'context'     => array( 'view', 'edit', 'embed' ),
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'modified'       => array(
+                                       'description' => __( "The date the template was last modified, in the site's timezone." ),
+                                       'type'        => 'string',
+                                       'format'      => 'date-time',
+                                       'context'     => array( 'view', 'edit' ),
+                                       'readonly'    => true,
+                               ),
</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>
<a id="trunktestsphpunittestsblocktemplateutilsphp"></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/block-template-utils.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/block-template-utils.php        2023-06-22 22:35:44 UTC (rev 55991)
+++ trunk/tests/phpunit/tests/block-template-utils.php  2023-06-23 06:27:45 UTC (rev 55992)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -101,6 +101,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( 'My Template', $template->title );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( 'Description of my template', $template->description );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( 'wp_template', $template->type );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $this->assertSame( self::$template_post->post_modified, $template->modified );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Test template parts.
</span><span class="cx" style="display: block; padding: 0 10px">                $template_part = _build_block_template_result_from_post(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -117,6 +118,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( 'Description of my template part', $template_part->description );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( 'wp_template_part', $template_part->type );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( WP_TEMPLATE_PART_AREA_HEADER, $template_part->area );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $this->assertSame( self::$template_part_post->post_modified, $template->modified );
</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">        public function test_build_block_template_result_from_file() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -136,6 +138,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( 'Single', $template->title );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( 'Displays single posts on your website unless a custom template has been applied to that post or a dedicated template exists.', $template->description );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( 'wp_template', $template->type );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $this->assertEmpty( $template->modified );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Test template parts.
</span><span class="cx" style="display: block; padding: 0 10px">                $template_part = _build_block_template_result_from_file(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -155,6 +158,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( '', $template_part->description );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( 'wp_template_part', $template_part->type );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( WP_TEMPLATE_PART_AREA_HEADER, $template_part->area );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $this->assertEmpty( $template_part->modified );
</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">        public function test_inject_theme_attribute_in_block_template_content() {
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapiwpRestTemplatesControllerphp"></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/rest-api/wpRestTemplatesController.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php  2023-06-22 22:35:44 UTC (rev 55991)
+++ trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php    2023-06-23 06:27:45 UTC (rev 55992)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -118,6 +118,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'has_theme_file' => false,
</span><span class="cx" style="display: block; padding: 0 10px">                                'is_custom'      => true,
</span><span class="cx" style="display: block; padding: 0 10px">                                'author'         => 0,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'modified'       => mysql_to_rfc3339( self::$post->post_modified ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->find_and_normalize_template_by_id( $data, 'default//my_template' )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -162,6 +163,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'has_theme_file' => false,
</span><span class="cx" style="display: block; padding: 0 10px">                                'is_custom'      => true,
</span><span class="cx" style="display: block; padding: 0 10px">                                'author'         => 0,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'modified'       => mysql_to_rfc3339( self::$post->post_modified ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $data
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -198,6 +200,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'has_theme_file' => false,
</span><span class="cx" style="display: block; padding: 0 10px">                                'is_custom'      => true,
</span><span class="cx" style="display: block; padding: 0 10px">                                'author'         => 0,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'modified'       => mysql_to_rfc3339( self::$post->post_modified ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $data
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -257,6 +260,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'has_theme_file' => false,
</span><span class="cx" style="display: block; padding: 0 10px">                                'is_custom'      => true,
</span><span class="cx" style="display: block; padding: 0 10px">                                'author'         => self::$admin_id,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'modified'       => mysql_to_rfc3339( $post->post_modified ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $data
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -413,6 +417,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $response = rest_get_server()->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px">                $data     = $response->get_data();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $modified = get_post( $data['wp_id'] )->post_modified;
</ins><span class="cx" style="display: block; padding: 0 10px">                 unset( $data['_links'] );
</span><span class="cx" style="display: block; padding: 0 10px">                unset( $data['wp_id'] );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -436,6 +441,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'has_theme_file' => false,
</span><span class="cx" style="display: block; padding: 0 10px">                                'is_custom'      => true,
</span><span class="cx" style="display: block; padding: 0 10px">                                'author'         => self::$admin_id,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'modified'       => mysql_to_rfc3339( $modified ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $data
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -459,6 +465,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $response = rest_get_server()->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px">                $data     = $response->get_data();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $modified = get_post( $data['wp_id'] )->post_modified;
</ins><span class="cx" style="display: block; padding: 0 10px">                 unset( $data['_links'] );
</span><span class="cx" style="display: block; padding: 0 10px">                unset( $data['wp_id'] );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -482,6 +489,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'has_theme_file' => false,
</span><span class="cx" style="display: block; padding: 0 10px">                                'is_custom'      => false,
</span><span class="cx" style="display: block; padding: 0 10px">                                'author'         => self::$admin_id,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'modified'       => mysql_to_rfc3339( $modified ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $data
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -509,6 +517,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                $response = rest_get_server()->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px">                $data     = $response->get_data();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $modified = get_post( $data['wp_id'] )->post_modified;
</ins><span class="cx" style="display: block; padding: 0 10px">                 unset( $data['_links'] );
</span><span class="cx" style="display: block; padding: 0 10px">                unset( $data['wp_id'] );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -532,6 +541,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'has_theme_file' => false,
</span><span class="cx" style="display: block; padding: 0 10px">                                'is_custom'      => true,
</span><span class="cx" style="display: block; padding: 0 10px">                                'author'         => self::$admin_id,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'modified'       => mysql_to_rfc3339( $modified ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        $data
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -690,7 +700,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $response   = rest_get_server()->dispatch( $request );
</span><span class="cx" style="display: block; padding: 0 10px">                $data       = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px">                $properties = $data['schema']['properties'];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertCount( 14, $properties );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertCount( 15, $properties );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertArrayHasKey( 'id', $properties );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'description', $properties );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'slug', $properties );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -706,6 +716,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'has_theme_file', $properties );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'is_custom', $properties );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertArrayHasKey( 'author', $properties );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $this->assertArrayHasKey( 'modified', $properties );
</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">        protected function find_and_normalize_template_by_id( $templates, $id ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -736,8 +747,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $request = new WP_REST_Request( 'POST', '/wp/v2/templates' );
</span><span class="cx" style="display: block; padding: 0 10px">                $request->set_body_params( $body_params );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $response = rest_get_server()->dispatch( $request );
-               $data     = $response->get_data();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $response             = rest_get_server()->dispatch( $request );
+               $data                 = $response->get_data();
+               $modified             = get_post( $data['wp_id'] )->post_modified;
+               $expected['modified'] = mysql_to_rfc3339( $modified );
</ins><span class="cx" style="display: block; padding: 0 10px">                 unset( $data['_links'] );
</span><span class="cx" style="display: block; padding: 0 10px">                unset( $data['wp_id'] );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre>
</div>
</div>

</body>
</html>