<!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>[40629] trunk/tests: REST API: Tests: Remove and prohibit errors when generating `wp-api.js` fixtures.</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 { 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/40629">40629</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/40629","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>jnylen0</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2017-05-11 18:31:26 +0000 (Thu, 11 May 2017)</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: Tests: Remove and prohibit errors when generating `wp-api.js` fixtures.

During a PHPUnit test suite run, a file named `wp-api-generated.js` is created which contains some response objects that serve as fixtures for the `wp-api.js` client unit tests.

Previously, some of these API responses were actually error objects, which isn't what we want for testing.  This commit fixes the existing error responses and prevents this situation in the future.

Fixes <a href="https://core.trac.wordpress.org/ticket/40734">#40734</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsrestapirestschemasetupphp">trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php</a></li>
<li><a href="#trunktestsqunitfixtureswpapigeneratedjs">trunk/tests/qunit/fixtures/wp-api-generated.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsphpunittestsrestapirestschemasetupphp"></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/rest-schema-setup.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php  2017-05-11 18:18:00 UTC (rev 40628)
+++ trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php    2017-05-11 18:31:26 UTC (rev 40629)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -13,6 +13,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @group restapi-jsclient
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        const YOUTUBE_VIDEO_ID = 'i_cVJgIz_Cs';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        public function setUp() {
</span><span class="cx" style="display: block; padding: 0 10px">                parent::setUp();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -21,16 +22,55 @@
</span><span class="cx" style="display: block; padding: 0 10px">                global $wp_rest_server;
</span><span class="cx" style="display: block; padding: 0 10px">                $this->server = $wp_rest_server = new Spy_REST_Server;
</span><span class="cx" style="display: block; padding: 0 10px">                do_action( 'rest_api_init' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               add_filter( 'pre_http_request', array( $this, 'mock_embed_request' ), 10, 3 );
</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 tearDown() {
</span><span class="cx" style="display: block; padding: 0 10px">                parent::tearDown();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                remove_filter( 'rest_url', array( $this, 'test_rest_url_for_leading_slash' ), 10, 2 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                 /** @var WP_REST_Server $wp_rest_server */
</span><span class="cx" style="display: block; padding: 0 10px">                global $wp_rest_server;
</span><span class="cx" style="display: block; padding: 0 10px">                $wp_rest_server = null;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               remove_filter( 'pre_http_request', array( $this, 'mock_embed_request' ), 10, 3 );
</ins><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">+        public function mock_embed_request( $preempt, $r, $url ) {
+               unset( $preempt, $r );
+
+               // Mock request to YouTube Embed.
+               if ( false !== strpos( $url, self::YOUTUBE_VIDEO_ID ) ) {
+                       return array(
+                               'response' => array(
+                                       'code' => 200,
+                               ),
+                               'body' => wp_json_encode(
+                                       array(
+                                               'version'          => '1.0',
+                                               'type'             => 'video',
+                                               'provider_name'    => 'YouTube',
+                                               'provider_url'     => 'https://www.youtube.com',
+                                               'thumbnail_width'  => 480,
+                                               'width'            => 500,
+                                               'thumbnail_height' => 360,
+                                               'html'             => '<iframe width="500" height="375" src="https://www.youtube.com/embed/' . self::YOUTUBE_VIDEO_ID . '?feature=oembed" frameborder="0" allowfullscreen></iframe>',
+                                               'author_name'      => 'Jorge Rubira Santos',
+                                               'thumbnail_url'    => 'https://i.ytimg.com/vi/' . self::YOUTUBE_VIDEO_ID . '/hqdefault.jpg',
+                                               'title'            => 'No te olvides de poner el Where en el Delete From. (Una cancion para programadores)',
+                                               'height'           => 375,
+                                       )
+                               ),
+                       );
+               } else {
+                       return array(
+                               'response' => array(
+                                       'code' => 404,
+                               ),
+                       );
+               }
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         public function test_expected_routes_in_schema() {
</span><span class="cx" style="display: block; padding: 0 10px">                $routes = $this->server->get_routes();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -109,6 +149,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'ID'           => $post_id,
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_content' => 'Updated post content.',
</span><span class="cx" style="display: block; padding: 0 10px">                ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $post_revisions = array_values( wp_get_post_revisions( $post_id ) );
+               $post_revision_id = $post_revisions[ count( $post_revisions ) - 1 ]->ID;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $page_id = $this->factory->post->create( array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_type'      => 'page',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -124,6 +166,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'ID'           => $page_id,
</span><span class="cx" style="display: block; padding: 0 10px">                        'post_content' => 'Updated page content.',
</span><span class="cx" style="display: block; padding: 0 10px">                ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $page_revisions = array_values( wp_get_post_revisions( $page_id ) );
+               $page_revision_id = $page_revisions[ count( $page_revisions ) - 1 ]->ID;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $tag_id = $this->factory->tag->create( array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'name'        => 'REST API Client Fixture: Tag',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -165,10 +209,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'route' => '/oembed/1.0/embed',
</span><span class="cx" style="display: block; padding: 0 10px">                                'name'  => 'oembeds',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'args'  => array(
+                                       'url' => '?p=' . $post_id,
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'route' => '/oembed/1.0/proxy',
</span><span class="cx" style="display: block; padding: 0 10px">                                'name'  => 'oembedProxy',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'args'  => array(
+                                       'url' => 'https://www.youtube.com/watch?v=i_cVJgIz_Cs',
+                               ),
</ins><span class="cx" style="display: block; padding: 0 10px">                         ),
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'route' => '/wp/v2/posts',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -183,7 +233,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'name'  => 'postRevisions',
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'route' => '/wp/v2/posts/' . $post_id . '/revisions/1',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'route' => '/wp/v2/posts/' . $post_id . '/revisions/' . $post_revision_id,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 'name'  => 'revision',
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -199,7 +249,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'name'  => 'pageRevisions',
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'route' => '/wp/v2/pages/'. $page_id . '/revisions/1',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'route' => '/wp/v2/pages/'. $page_id . '/revisions/' . $page_revision_id,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 'name'  => 'pageRevision',
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -215,7 +265,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'name'  => 'TypesCollection',
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'route' => '/wp/v2/types/',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'route' => '/wp/v2/types/post',
</ins><span class="cx" style="display: block; padding: 0 10px">                                 'name'  => 'TypeModel',
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -267,7 +317,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'name'  => 'CommentsCollection',
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'route' => '/wp/v2/comments/1',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'route' => '/wp/v2/comments/' . $comment_id,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 'name'  => 'CommentModel',
</span><span class="cx" style="display: block; padding: 0 10px">                        ),
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -285,9 +335,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                foreach ( $routes_to_generate_data as $route ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $request = new WP_REST_Request( 'GET', $route['route'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        if ( isset( $route['args'] ) ) {
+                               $request->set_query_params( $route['args'] );
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                         $response = $this->server->dispatch( $request );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        $status = $response->get_status();
</ins><span class="cx" style="display: block; padding: 0 10px">                         $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        $this->assertEquals(
+                               200,
+                               $response->get_status(),
+                               "HTTP $status from $route[route]: " . json_encode( $data )
+                       );
</ins><span class="cx" style="display: block; padding: 0 10px">                         $this->assertTrue( ! empty( $data ), $route['name'] . ' route should return data.' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( version_compare( PHP_VERSION, '5.4', '>=' ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -319,6 +378,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * how they were generated, see #39264.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        private static $fixture_replacements = array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                'oembeds.html' => '<blockquote class="wp-embedded-content">...</blockquote>',
</ins><span class="cx" style="display: block; padding: 0 10px">                 'PostsCollection.0.id' => 3,
</span><span class="cx" style="display: block; padding: 0 10px">                'PostsCollection.0.guid.rendered' => 'http://example.org/?p=3',
</span><span class="cx" style="display: block; padding: 0 10px">                'PostsCollection.0.link' => 'http://example.org/?p=3',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -331,12 +391,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                'PostModel.id' => 3,
</span><span class="cx" style="display: block; padding: 0 10px">                'PostModel.guid.rendered' => 'http://example.org/?p=3',
</span><span class="cx" style="display: block; padding: 0 10px">                'PostModel.link' => 'http://example.org/?p=3',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                'postRevisions.0.author' => '2',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'postRevisions.0.author' => 2,
</ins><span class="cx" style="display: block; padding: 0 10px">                 'postRevisions.0.id' => 4,
</span><span class="cx" style="display: block; padding: 0 10px">                'postRevisions.0.parent' => 3,
</span><span class="cx" style="display: block; padding: 0 10px">                'postRevisions.0.slug' => '3-revision-v1',
</span><span class="cx" style="display: block; padding: 0 10px">                'postRevisions.0.guid.rendered' => 'http://example.org/?p=4',
</span><span class="cx" style="display: block; padding: 0 10px">                'postRevisions.0._links.parent.0.href' => 'http://example.org/?rest_route=/wp/v2/posts/3',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                'revision.author' => 2,
+               'revision.id' => 4,
+               'revision.parent' => 3,
+               'revision.slug' => '3-revision-v1',
+               'revision.guid.rendered' => 'http://example.org/?p=4',
</ins><span class="cx" style="display: block; padding: 0 10px">                 'PagesCollection.0.id' => 5,
</span><span class="cx" style="display: block; padding: 0 10px">                'PagesCollection.0.guid.rendered' => 'http://example.org/?page_id=5',
</span><span class="cx" style="display: block; padding: 0 10px">                'PagesCollection.0.link' => 'http://example.org/?page_id=5',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -347,12 +412,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">                'PageModel.id' => 5,
</span><span class="cx" style="display: block; padding: 0 10px">                'PageModel.guid.rendered' => 'http://example.org/?page_id=5',
</span><span class="cx" style="display: block; padding: 0 10px">                'PageModel.link' => 'http://example.org/?page_id=5',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                'pageRevisions.0.author' => '2',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'pageRevisions.0.author' => 2,
</ins><span class="cx" style="display: block; padding: 0 10px">                 'pageRevisions.0.id' => 6,
</span><span class="cx" style="display: block; padding: 0 10px">                'pageRevisions.0.parent' => 5,
</span><span class="cx" style="display: block; padding: 0 10px">                'pageRevisions.0.slug' => '5-revision-v1',
</span><span class="cx" style="display: block; padding: 0 10px">                'pageRevisions.0.guid.rendered' => 'http://example.org/?p=6',
</span><span class="cx" style="display: block; padding: 0 10px">                'pageRevisions.0._links.parent.0.href' => 'http://example.org/?rest_route=/wp/v2/pages/5',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                'pageRevision.author' => 2,
+               'pageRevision.id' => 6,
+               'pageRevision.parent' => 5,
+               'pageRevision.slug' => '5-revision-v1',
+               'pageRevision.guid.rendered' => 'http://example.org/?p=6',
</ins><span class="cx" style="display: block; padding: 0 10px">                 'MediaCollection.0.id' => 7,
</span><span class="cx" style="display: block; padding: 0 10px">                'MediaCollection.0.guid.rendered' => 'http://example.org/?attachment_id=7',
</span><span class="cx" style="display: block; padding: 0 10px">                'MediaCollection.0.link' => 'http://example.org/?attachment_id=7',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -377,6 +447,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                'CommentsCollection.0.link' => 'http://example.org/?p=3#comment-2',
</span><span class="cx" style="display: block; padding: 0 10px">                'CommentsCollection.0._links.self.0.href' => 'http://example.org/?rest_route=/wp/v2/comments/2',
</span><span class="cx" style="display: block; padding: 0 10px">                'CommentsCollection.0._links.up.0.href' => 'http://example.org/?rest_route=/wp/v2/posts/3',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                'CommentModel.id' => 2,
+               'CommentModel.post' => 3,
+               'CommentModel.link' => 'http://example.org/?p=3#comment-2',
</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">        private function normalize_fixture( $data, $path ) {
</span></span></pre></div>
<a id="trunktestsqunitfixtureswpapigeneratedjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/qunit/fixtures/wp-api-generated.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/qunit/fixtures/wp-api-generated.js    2017-05-11 18:18:00 UTC (rev 40628)
+++ trunk/tests/qunit/fixtures/wp-api-generated.js      2017-05-11 18:31:26 UTC (rev 40629)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3501,25 +3501,31 @@
</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"> mockedApiResponse.oembeds = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    "code": "rest_missing_callback_param",
-    "message": "Missing parameter(s): url",
-    "data": {
-        "status": 400,
-        "params": [
-            "url"
-        ]
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    "version": "1.0",
+    "provider_name": "Test Blog",
+    "provider_url": "http://example.org",
+    "author_name": "Test Blog",
+    "author_url": "http://example.org",
+    "title": "REST API Client Fixture: Post",
+    "type": "rich",
+    "width": 600,
+    "height": 338,
+    "html": "<blockquote class=\"wp-embedded-content\">...</blockquote>"
</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"> mockedApiResponse.oembedProxy = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    "code": "rest_missing_callback_param",
-    "message": "Missing parameter(s): url",
-    "data": {
-        "status": 400,
-        "params": [
-            "url"
-        ]
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    "version": "1.0",
+    "type": "video",
+    "provider_name": "YouTube",
+    "provider_url": "https://www.youtube.com",
+    "thumbnail_width": 480,
+    "width": 500,
+    "thumbnail_height": 360,
+    "html": "<iframe width=\"500\" height=\"375\" src=\"https://www.youtube.com/embed/i_cVJgIz_Cs?feature=oembed\" frameborder=\"0\" allowfullscreen></iframe>",
+    "author_name": "Jorge Rubira Santos",
+    "thumbnail_url": "https://i.ytimg.com/vi/i_cVJgIz_Cs/hqdefault.jpg",
+    "title": "No te olvides de poner el Where en el Delete From. (Una cancion para programadores)",
+    "height": 375
</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"> mockedApiResponse.PostsCollection = [
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3654,7 +3660,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> mockedApiResponse.postRevisions = [
</span><span class="cx" style="display: block; padding: 0 10px">     {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "author": "2",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "author": 2,
</ins><span class="cx" style="display: block; padding: 0 10px">         "date": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">         "date_gmt": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">         "id": 4,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3685,10 +3691,25 @@
</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"> mockedApiResponse.revision = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    "code": "rest_post_invalid_id",
-    "message": "Invalid revision ID.",
-    "data": {
-        "status": 404
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    "author": 2,
+    "date": "2017-02-14T00:00:00",
+    "date_gmt": "2017-02-14T00:00:00",
+    "id": 4,
+    "modified": "2017-02-14T00:00:00",
+    "modified_gmt": "2017-02-14T00:00:00",
+    "parent": 3,
+    "slug": "3-revision-v1",
+    "guid": {
+        "rendered": "http://example.org/?p=4"
+    },
+    "title": {
+        "rendered": "REST API Client Fixture: Post"
+    },
+    "content": {
+        "rendered": "<p>Updated post content.</p>\n"
+    },
+    "excerpt": {
+        "rendered": "<p>REST API Client Fixture: Post</p>\n"
</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">@@ -3804,7 +3825,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> mockedApiResponse.pageRevisions = [
</span><span class="cx" style="display: block; padding: 0 10px">     {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "author": "2",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "author": 2,
</ins><span class="cx" style="display: block; padding: 0 10px">         "date": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">         "date_gmt": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">         "id": 6,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3835,10 +3856,25 @@
</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"> mockedApiResponse.pageRevision = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    "code": "rest_post_invalid_id",
-    "message": "Invalid revision ID.",
-    "data": {
-        "status": 404
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    "author": 2,
+    "date": "2017-02-14T00:00:00",
+    "date_gmt": "2017-02-14T00:00:00",
+    "id": 6,
+    "modified": "2017-02-14T00:00:00",
+    "modified_gmt": "2017-02-14T00:00:00",
+    "parent": 5,
+    "slug": "5-revision-v1",
+    "guid": {
+        "rendered": "http://example.org/?p=6"
+    },
+    "title": {
+        "rendered": "REST API Client Fixture: Page"
+    },
+    "content": {
+        "rendered": "<p>Updated page content.</p>\n"
+    },
+    "excerpt": {
+        "rendered": "<p>REST API Client Fixture: Page</p>\n"
</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">@@ -4025,11 +4061,15 @@
</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"> mockedApiResponse.TypeModel = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    "code": "rest_no_route",
-    "message": "No route was found matching the URL and request method",
-    "data": {
-        "status": 404
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    "description": "",
+    "hierarchical": false,
+    "name": "Posts",
+    "slug": "post",
+    "taxonomies": [
+        "category",
+        "post_tag"
+    ],
+    "rest_base": "posts"
</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"> mockedApiResponse.StatusesCollection = {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4430,11 +4470,26 @@
</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"> mockedApiResponse.CommentModel = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    "code": "rest_comment_invalid_id",
-    "message": "Invalid comment ID.",
-    "data": {
-        "status": 404
-    }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    "id": 2,
+    "post": 3,
+    "parent": 0,
+    "author": 0,
+    "author_name": "Internet of something or other",
+    "author_url": "http://lights.example.org/",
+    "date": "2017-02-14T00:00:00",
+    "date_gmt": "2017-02-14T00:00:00",
+    "content": {
+        "rendered": "<p>This is a comment</p>\n"
+    },
+    "link": "http://example.org/?p=3#comment-2",
+    "status": "approved",
+    "type": "comment",
+    "author_avatar_urls": {
+        "24": "http://2.gravatar.com/avatar/bd7c2b505bcf39cc71cfee564c614956?s=24&d=mm&r=g",
+        "48": "http://2.gravatar.com/avatar/bd7c2b505bcf39cc71cfee564c614956?s=48&d=mm&r=g",
+        "96": "http://2.gravatar.com/avatar/bd7c2b505bcf39cc71cfee564c614956?s=96&d=mm&r=g"
+    },
+    "meta": []
</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"> mockedApiResponse.settings = {
</span></span></pre>
</div>
</div>

</body>
</html>