Skip to content

Commit 36bd553

Browse files
authored
Merge pull request WordPress#3 from spacedmonkey/fix/covers
Add covers to REST API endpoints props @spacedmonkey
2 parents 2c98d29 + b0e496a commit 36bd553

8 files changed

Lines changed: 682 additions & 5 deletions

‎tests/phpunit/tests/rest-api/rest-attachments-controller.php‎

Lines changed: 163 additions & 0 deletions
Large diffs are not rendered by default.

‎tests/phpunit/tests/rest-api/rest-block-type-controller.php‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
§<?php
22
/**
33
* WP_REST_Block_Types_Controller tests.
44
*
@@ -16,6 +16,7 @@
1616
*
1717
* @group restapi-blocks
1818
* @group restapi
19+
* @coversDefaultClass WP_REST_Block_Types_Controller
1920
*/
2021
class REST_Block_Type_Controller_Test extends WP_Test_REST_Controller_Testcase {
2122

@@ -85,6 +86,7 @@ public function test_register_routes() {
8586

8687
/**
8788
* @ticket 47620
89+
* @covers ::get_context_param
8890
*/
8991
public function test_context_param() {
9092
// Collection.
@@ -103,6 +105,7 @@ public function test_context_param() {
103105

104106
/**
105107
* @ticket 47620
108+
* @covers ::get_items
106109
*/
107110
public function test_get_items() {
108111
$block_name = 'fake/test';
@@ -117,6 +120,7 @@ public function test_get_items() {
117120

118121
/**
119122
* @ticket 47620
123+
* @covers ::get_item
120124
*/
121125
public function test_get_item() {
122126
$block_name = 'fake/test';
@@ -129,6 +133,7 @@ public function test_get_item() {
129133

130134
/**
131135
* @ticket 47620
136+
* @covers ::get_item
132137
*/
133138
public function test_get_item_with_styles() {
134139
$block_name = 'fake/styles';
@@ -149,6 +154,7 @@ public function test_get_item_with_styles() {
149154

150155
/**
151156
* @ticket 47620
157+
* @covers ::get_item
152158
*/
153159
public function test_get_item_with_styles_merge() {
154160
$block_name = 'fake/styles2';
@@ -190,6 +196,7 @@ public function test_get_item_with_styles_merge() {
190196

191197
/**
192198
* @ticket 47620
199+
* @covers ::get_item
193200
*/
194201
public function test_get_block_invalid_name() {
195202
$block_type = 'fake/block';
@@ -202,6 +209,7 @@ public function test_get_block_invalid_name() {
202209

203210
/**
204211
* @ticket 47620
212+
* @covers ::get_item
205213
*/
206214
public function test_get_item_invalid() {
207215
$block_type = 'fake/invalid';
@@ -255,6 +263,7 @@ public function test_get_item_invalid() {
255263

256264
/**
257265
* @ticket 47620
266+
* @covers ::get_item
258267
*/
259268
public function test_get_item_defaults() {
260269
$block_type = 'fake/false';
@@ -307,6 +316,9 @@ public function test_get_item_defaults() {
307316
$this->assertSameSets( array(), $data['variations'] );
308317
}
309318

319+
/**
320+
* @covers ::get_item
321+
*/
310322
public function test_get_variation() {
311323
$block_type = 'fake/variations';
312324
$settings = array(
@@ -367,6 +379,7 @@ public function test_get_variation() {
367379

368380
/**
369381
* @ticket 47620
382+
* @covers ::get_item_schema
370383
*/
371384
public function test_get_item_schema() {
372385
wp_set_current_user( self::$admin_id );
@@ -400,6 +413,7 @@ public function test_get_item_schema() {
400413

401414
/**
402415
* @ticket 47620
416+
* @covers ::get_items
403417
*/
404418
public function test_get_items_wrong_permission() {
405419
wp_set_current_user( self::$subscriber_id );
@@ -410,6 +424,7 @@ public function test_get_items_wrong_permission() {
410424

411425
/**
412426
* @ticket 47620
427+
* @covers ::get_item
413428
*/
414429
public function test_get_item_wrong_permission() {
415430
wp_set_current_user( self::$subscriber_id );
@@ -420,6 +435,7 @@ public function test_get_item_wrong_permission() {
420435

421436
/**
422437
* @ticket 47620
438+
* @covers ::get_items
423439
*/
424440
public function test_get_items_no_permission() {
425441
wp_set_current_user( 0 );
@@ -430,6 +446,8 @@ public function test_get_items_no_permission() {
430446

431447
/**
432448
* @ticket 47620
449+
* @covers ::get_item
450+
* @covers ::get_item_permissions_check
433451
*/
434452
public function test_get_item_no_permission() {
435453
wp_set_current_user( 0 );
@@ -440,6 +458,7 @@ public function test_get_item_no_permission() {
440458

441459
/**
442460
* @ticket 47620
461+
* @covers ::prepare_item_for_response
443462
*/
444463
public function test_prepare_item() {
445464
$registry = new WP_Block_Type_Registry;
@@ -458,6 +477,7 @@ public function test_prepare_item() {
458477

459478
/**
460479
* @ticket 47620
480+
* @covers ::prepare_item_for_response
461481
*/
462482
public function test_prepare_item_limit_fields() {
463483
$registry = new WP_Block_Type_Registry;

0 commit comments

Comments
 (0)