You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a5c41fa
Browse filesBrowse the repository at this point in the historyBrowse files
Abilities API: Declare the uri format for the link output of core/content-query.
The post permalink in the `link` output was a plain string, while the `link` output of `core/users-query` declares the `uri` format. Declare the same format for the post permalink, so clients that check formats treat both links the same. The value is unchanged.
Developed in #15987.
Follow-up to [64388].
Props jorgefilipecosta, gziolo.
Fixes #66268.
git-svn-id: https://develop.svn.wordpress.org/trunk@65724 602fd350-edb4-49c9-b593-d223f7449a82
Copy file name to clipboardExpand all lines: tests/phpunit/tests/abilities-api/wpRegisterCoreContentAbility.php
+78Lines changed: 78 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -780,6 +780,7 @@ public function test_output_schema_describes_query_responses(): void {
780
780
}
781
781
$this->assertStringContainsString( "in ISO 8601 format using the site's timezone.", $post_schema['properties'][ $name ]['properties']['site']['description'], sprintf( 'The %s.site description should say the date uses the site timezone.', $name ) );
782
782
}
783
+
$this->assertSame( 'uri', $post_schema['properties']['link']['format'], 'The link should use the uri format.' );
783
784
784
785
$this->assertSame( 'object', $pagination['type'], 'The pagination should describe an object.' );
785
786
$this->assertFalse( $pagination['additionalProperties'], 'The pagination should not allow keys besides the totals.' );
$this->assertIsArray( $result, 'The query should succeed.' );
891
+
$this->assertCount( 1, $result['items'], 'The query should return the post.' );
892
+
893
+
$link = $result['items'][0]['link'];
894
+
if ( $plain_permalink ) {
895
+
$this->assertSame( home_url( '?p=' . $post_id ), $link, 'Precondition: the post should link to its plain permalink.' );
896
+
} else {
897
+
$this->assertStringNotContainsString( '?', $link, 'Precondition: the post should link to its pretty permalink.' );
898
+
}
899
+
$this->assertSame( get_permalink( $post_id ), $link, 'The link should be the permalink.' );
900
+
$this->assertTrue( rest_validate_value_from_schema( $result, $ability->get_output_schema(), 'result' ), 'The result should validate against the output schema.' );
901
+
}
902
+
825
903
/**
826
904
* A post type registered by another active plugin and flagged `show_in_abilities`
827
905
* is exposed by the ability, both in the input enum and in query results.
0 commit comments