Make WordPress Core


Ignore:
Timestamp:
09/01/2022 10:54:19 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Explicitly mark empty REST API tests as not performing any assertions.

WordPress core test suite uses PHPUnit's beStrictAboutTestsThatDoNotTestAnything option set to true, which marks a test as risky when no assertions are performed.

REST API test classes have some empty tests for non-implemented methods because these test classes extend the abstract WP_Test_REST_Controller_Testcase class, which requires several methods to be implemented that don't necessarily make sense for all REST API routes.

As these tests are intentionally empty, they were previously marked as skipped, so that they are not reported as risky.

This commit aims to further reduce noise in the test suite and effectively ignores these empty tests altogether, which seems like a more appropriate option at this time.

The @doesNotPerformAssertions annotation can be reconsidered in the future when the tests are either removed as unnecessary or updated to actually perform assertions related to their behavior.

Follow-up to [40534], [41176], [41228], [53921].

See #40538, #41463, #55652.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/wpRestEditSiteExportController.php

    r53921 r54058  
    100100
    101101    /**
    102      * @ticket 54448
     102     * @doesNotPerformAssertions
    103103     */
    104104    public function test_context_param() {
    105         $this->markTestSkipped( 'Controller does not use get_context_param().' );
     105        // Controller does not use get_context_param().
    106106    }
    107107
    108108    /**
    109      * @ticket 54448
     109     * @doesNotPerformAssertions
    110110     */
    111111    public function test_get_item() {
    112         $this->markTestSkipped( 'Controller does not implement get_item().' );
     112        // Controller does not implement get_item().
    113113    }
    114114
    115115    /**
    116      * @ticket 54448
     116     * @doesNotPerformAssertions
    117117     */
    118118    public function test_get_items() {
    119         $this->markTestSkipped( 'Controller does not implement get_items().' );
     119        // Controller does not implement get_items().
    120120    }
    121121
    122122    /**
    123      * @ticket 54448
     123     * @doesNotPerformAssertions
    124124     */
    125125    public function test_create_item() {
    126         $this->markTestSkipped( 'Controller does not implement create_item().' );
     126        // Controller does not implement create_item().
    127127    }
    128128
    129129    /**
    130      * @ticket 54448
     130     * @doesNotPerformAssertions
    131131     */
    132132    public function test_update_item() {
    133         $this->markTestSkipped( 'Controller does not implement update_item().' );
     133        // Controller does not implement update_item().
    134134    }
    135135
    136136    /**
    137      * @ticket 54448
     137     * @doesNotPerformAssertions
    138138     */
    139139    public function test_delete_item() {
    140         $this->markTestSkipped( 'Controller does not implement delete_item().' );
     140        // Controller does not implement delete_item().
    141141    }
    142142
    143143    /**
    144      * @ticket 54448
     144     * @doesNotPerformAssertions
    145145     */
    146146    public function test_prepare_item() {
    147         $this->markTestSkipped( 'Controller does not implement prepare_item().' );
     147        // Controller does not implement prepare_item().
    148148    }
    149149
    150150    /**
    151      * @ticket 54448
     151     * @doesNotPerformAssertions
    152152     */
    153153    public function test_get_item_schema() {
    154         $this->markTestSkipped( 'Controller does not implement get_item_schema().' );
     154        // Controller does not implement get_item_schema().
    155155    }
    156156}
Note: See TracChangeset for help on using the changeset viewer.