Make WordPress Core

Changeset 62957


Ignore:
Timestamp:
07/31/2026 02:15:27 PM (8 weeks ago)
Author:
wildworks
Message:

Tests: Correct @param tags in various test methods.

Some @param tags did not match their method signatures. This corrects the names and types, and removes the tags for parameters that no longer exist.

Two @dataProvider annotations also had no effect. The one on test_prepare_item() is removed, and test_get_items_search_type_post_subtype_invalid() now accepts $method and passes it to the request.

Developed in: https://github.com/WordPress/wordpress-develop/pull/12208

Props Soean, mukesh27, wildworks.
See #64894.

Location:
trunk/tests/phpunit/tests
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/admin/includesFile.php

    r59934 r62957  
    400400         * @ticket 54738
    401401         *
    402          * @param string $filter A callback containing a fake Content-Type header.
    403          * @param string $ext The expected file extension to match.
     402         * @param callable $filter    A callback containing a fake Content-Type header.
     403         * @param string   $extension The expected file extension to match.
    404404         */
    405405        public function test_download_url_should_use_the_content_type_header_to_set_extension_of_a_file_if_extension_was_not_determined( $filter, $extension ) {
  • trunk/tests/phpunit/tests/dependencies/scripts.php

    r62723 r62957  
    558558         * @dataProvider get_data_to_filter_eligible_strategies
    559559         *
    560          * @param callable $set_up     Set up.
    561          * @param bool     $async_only Async only.
    562          * @param bool     $expected   Expected return value.
     560         * @param callable $set_up   Set up.
     561         * @param string[] $expected Expected return value.
    563562         */
    564563        public function test_filter_eligible_strategies( $set_up, $expected ) {
  • trunk/tests/phpunit/tests/filesystem/wpFilesystemDirect/delete.php

    r57753 r62957  
    7070         * @dataProvider data_should_delete_a_file
    7171         *
    72          * @param string $key The key for the file in `self::$filesystem_structure`.
     72         * @param string $file The key for the file in `self::$file_structure`.
    7373         */
    7474        public function test_should_delete_a_file( $file ) {
  • trunk/tests/phpunit/tests/filesystem/wpFilesystemDirect/isDir.php

    r57753 r62957  
    3636         *
    3737         * @param string $path The path to check.
    38          * @param string $type The type of resource. Accepts 'f' or 'd'.
    39          *                     Used to invert $expected due to data provider setup.
    4038         */
    4139        public function test_should_determine_that_a_path_is_not_a_directory( $path ) {
  • trunk/tests/phpunit/tests/functions/allowedProtocols.php

    r57735 r62957  
    2828         * @dataProvider data_example_urls
    2929         *
    30          * @param string The scheme.
    31          * @param string Example URL.
     30         * @param string $protocol The scheme.
     31         * @param string $url      Example URL.
    3232         */
    3333        public function test_allowed_protocols( $protocol, $url ) {
  • trunk/tests/phpunit/tests/functions/doEnclose.php

    r56971 r62957  
    222222         * @since 5.3.0
    223223         *
    224          * @param  array $post_links An array of enclosure links.
    225          * @param  int   $post_id    Post ID.
     224         * @param  array $enclosure_links An array of enclosure links.
     225         * @param  int   $post_id         Post ID.
    226226         * @return array An array of enclosure links.
    227227         */
  • trunk/tests/phpunit/tests/image/meta.php

    r61841 r62957  
    185185         * @ticket 52922
    186186         *
    187          * @param string Stream's URI.
    188          * @param array  Expected metadata.
     187         * @param string $file     Stream's URI.
     188         * @param array  $expected Expected metadata.
    189189         */
    190190        public function test_stream( $file, $expected ) {
  • trunk/tests/phpunit/tests/multisite/updateBlogDetails.php

    r62237 r62957  
    5454         * @param string $flag       The name of the flag being set or unset on a site.
    5555         * @param string $flag_value '0' or '1'. The value of the flag being set.
    56          * @param string $action     The hook expected to fire for the flag name and flag combination.
     56         * @param string $hook       The hook expected to fire for the flag name and flag combination.
    5757         *
    5858         * @dataProvider data_flag_hooks
  • trunk/tests/phpunit/tests/post.php

    r61417 r62957  
    669669         * @ticket 52007
    670670         * @covers ::stick_post
    671          *
    672          * @param mixed $stick Value to pass to stick_post().
    673671         */
    674672        public function test_stick_post_removes_duplicate_post_ids_when_adding_new_value() {
  • trunk/tests/phpunit/tests/privacy/wpPrivacyProcessPersonalDataExportPage.php

    r57099 r62957  
    359359         * @dataProvider data_send_as_email_options
    360360         *
    361          * @param bool Whether the final results of the export should be emailed to the user.
     361         * @param bool $send_as_email Whether the final results of the export should be emailed to the user.
    362362         */
    363363        public function test_send_error_when_invalid_request_id( $send_as_email ) {
     
    389389         * @dataProvider data_send_as_email_options
    390390         *
    391          * @param bool Whether the final results of the export should be emailed to the user.
     391         * @param bool $send_as_email Whether the final results of the export should be emailed to the user.
    392392         */
    393393        public function test_send_error_when_invalid_request_action_name( $send_as_email ) {
     
    421421         * @dataProvider data_send_as_email_options
    422422         *
    423          * @param bool Whether the final results of the export should be emailed to the user.
    424          *
     423         * @param bool $send_as_email Whether the final results of the export should be emailed to the user.
    425424         */
    426425        public function test_raw_data_post_meta( $send_as_email ) {
     
    462461         * @dataProvider data_send_as_email_options
    463462         *
    464          * @param bool Whether the final results of the export should be emailed to the user.
     463         * @param bool $send_as_email Whether the final results of the export should be emailed to the user.
    465464         */
    466465        public function test_add_post_meta_with_groups_data_only_available_when_export_file_generated( $send_as_email ) {
  • trunk/tests/phpunit/tests/rest-api/rest-block-type-controller.php

    r59970 r62957  
    751751
    752752        /**
    753          * @dataProvider data_readable_http_methods
    754753         * @ticket 47620
    755754         * @ticket 56481
    756          *
    757          * @param string $method HTTP method to use.
    758755         */
    759756        public function test_prepare_item() {
  • trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php

    r62829 r62957  
    36473647         * Create a test post with note.
    36483648         *
    3649          * @param int $user_id Post author's user ID.
     3649         * @param string $role User role to assign the post author.
    36503650         * @return int Post ID.
    36513651         */
  • trunk/tests/phpunit/tests/rest-api/rest-search-controller.php

    r59899 r62957  
    361361         * @param string $method HTTP method to use.
    362362         */
    363         public function test_get_items_search_type_post_subtype_invalid() {
     363        public function test_get_items_search_type_post_subtype_invalid( $method ) {
    364364                $response = $this->do_request_with_params(
    365365                        array(
     
    367367                                'type'     => 'post',
    368368                                'subtype'  => 'invalid',
    369                         )
     369                        ),
     370                        $method
    370371                );
    371372
  • trunk/tests/phpunit/tests/rest-api/wpRestBlockPatternCategoriesController.php

    r60729 r62957  
    142142        /**
    143143         * @ticket 56481
    144          *
    145          * @param string $path The path to test.
    146144         */
    147145        public function test_head_request_with_specified_fields_returns_success_response() {
  • trunk/tests/phpunit/tests/rewrite.php

    r54364 r62957  
    168168         * @param string      $path        Path relative to the home URL. Blank string if no path is specified.
    169169         * @param string|null $orig_scheme Scheme to give the home URL context.
    170          * @param int|null    $blog_id     Site ID, or null for the current site.
     170         * @param int|null    $_blog_id    Site ID, or null for the current site.
    171171         * @return string                  The complete home URL including scheme and path.
    172172         */
Note: See TracChangeset for help on using the changeset viewer.