Make WordPress Core


Ignore:
Timestamp:
03/23/2022 03:01:48 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Docs: Adjust documentation in get_post_galleries() tests per the documentation standards.

Follow-up to [52190], [52797].

Props azouamauriac, SergeyBiryukov.
See #54725, #54729.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/media/getPostGalleries.php

    r52797 r52984  
    1717
    1818        /**
    19          * Test that an empty array is returned for a post that does not exist.
     19         * Tests that an empty array is returned for a post that does not exist.
    2020         *
    2121         * @ticket 43826
     
    2727
    2828        /**
    29          * Test that an empty array is returned for a post that has no gallery.
     29         * Tests that an empty array is returned for a post that has no gallery.
    3030         *
    3131         * @ticket 43826
     
    4343
    4444        /**
    45          * Test that only galleries are returned.
     45         * Tests that only galleries are returned.
    4646         *
    4747         * @dataProvider data_returns_only_galleries
     
    119119
    120120        /**
    121          * Test that no srcs are returned for a shortcode gallery
     121         * Tests that no srcs are returned for a shortcode gallery
    122122         * in a post with no attached images.
    123123         *
     
    151151                );
    152152
    153                 // This prevents future changes from causing
    154                 // backwards compatibility breaks.
     153                /*
     154                 * This prevents future changes from causing
     155                 * backwards compatibility breaks.
     156                 */
    155157                $this->assertArrayHasKey(
    156158                        'src',
     
    166168
    167169        /**
    168          * Test that no srcs are returned for a gallery block
     170         * Tests that no srcs are returned for a gallery block
    169171         * in a post with no attached images.
    170172         *
     
    198200                );
    199201
    200                 // The method can return an array of strings
    201                 // instead of an array of arrays.
     202                /*
     203                 * The method can return an array of strings
     204                 * instead of an array of arrays.
     205                 */
    202206                $this->assertIsArray(
    203207                        $galleries[0],
     
    205209                );
    206210
    207                 // This prevents future changes from causing
    208                 // backwards compatibility breaks.
     211                /*
     212                 * This prevents future changes from causing
     213                 * backwards compatibility breaks.
     214                 */
    209215                $this->assertArrayHasKey(
    210216                        'src',
     
    220226
    221227        /**
    222          * Test that no srcs are returned for a gallery block v2
     228         * Tests that no srcs are returned for a gallery block v2
    223229         * in a post with no attached images.
    224230         *
     
    273279                );
    274280
    275                 // The method can return an array of strings
    276                 // instead of an array of arrays.
     281                /*
     282                 * The method can return an array of strings
     283                 * instead of an array of arrays.
     284                 */
    277285                $this->assertIsArray(
    278286                        $galleries[0],
     
    280288                );
    281289
    282                 // This prevents future changes from causing
    283                 // backwards compatibility breaks.
     290                /*
     291                 * This prevents future changes from causing
     292                 * backwards compatibility breaks.
     293                 */
    284294                $this->assertArrayHasKey(
    285295                        'src',
     
    296306
    297307        /**
    298          * Test that HTML is returned for a shortcode gallery.
     308         * Tests that HTML is returned for a shortcode gallery.
    299309         *
    300310         * @ticket 43826
     
    333343                );
    334344
    335                 // The method can return an array of arrays
    336                 // instead of an array of strings.
     345                /*
     346                 * The method can return an array of arrays
     347                 * instead of an array of strings.
     348                 */
    337349                $this->assertIsString(
    338350                        $galleries[0],
     
    348360
    349361        /**
    350          * Test that HTML is returned for a block gallery.
     362         * Tests that HTML is returned for a block gallery.
    351363         *
    352364         * @ticket 43826
     
    394406                );
    395407
    396                 // The method can return an array of arrays
    397                 // instead of an array of strings.
     408                /*
     409                 * The method can return an array of arrays
     410                 * instead of an array of strings.
     411                 */
    398412                $this->assertIsString(
    399413                        $galleries[0],
     
    409423
    410424        /**
    411          * Test that HTML is returned for a block gallery v2.
     425         * Tests that HTML is returned for a block gallery v2.
    412426         *
    413427         * @ticket 43826
     
    460474                );
    461475
    462                 // The method can return an array of arrays
    463                 // instead of an array of strings.
     476                /*
     477                 * The method can return an array of arrays
     478                 * instead of an array of strings.
     479                 */
    464480                $this->assertIsString(
    465481                        $galleries[0],
     
    475491
    476492        /**
    477          * Test that the global post object does not override
     493         * Tests that the global post object does not override
    478494         * a provided post ID with a shortcode gallery.
    479495         *
     
    516532                );
    517533
    518                 // This prevents future changes from causing
    519                 // backwards compatibility breaks.
     534                /*
     535                 * This prevents future changes from causing
     536                 * backwards compatibility breaks.
     537                 */
    520538                $this->assertArrayHasKey(
    521539                        'src',
     
    532550
    533551        /**
    534          * Test that the global post object does not override
     552         * Tests that the global post object does not override
    535553         * a provided post ID with a block gallery.
    536554         *
     
    602620                );
    603621
    604                 // This prevents future changes from causing
    605                 // backwards compatibility breaks.
     622                /*
     623                 * This prevents future changes from causing
     624                 * backwards compatibility breaks.
     625                 */
    606626                $this->assertArrayHasKey(
    607627                        'src',
     
    623643
    624644        /**
    625          * Test that the global post object does not override
     645         * Tests that the global post object does not override
    626646         * a provided post ID with a block gallery v2.
    627647         *
     
    695715                );
    696716
    697                 // This prevents future changes from causing
    698                 // backwards compatibility breaks.
     717                /*
     718                 * This prevents future changes from causing
     719                 * backwards compatibility breaks.
     720                 */
    699721                $this->assertArrayHasKey(
    700722                        'src',
     
    716738
    717739        /**
    718          * Test that the gallery only contains images specified in
     740         * Tests that the gallery only contains images specified in
    719741         * the shortcode's id attribute.
    720742         *
     
    765787                );
    766788
    767                 // The method can return an array of strings
    768                 // instead of an array of arrays.
     789                /*
     790                 * The method can return an array of strings
     791                 * instead of an array of arrays.
     792                 */
    769793                $this->assertIsArray(
    770794                        $galleries[0],
     
    772796                );
    773797
    774                 // This prevents future changes from causing
    775                 // backwards compatibility breaks.
     798                /*
     799                 * This prevents future changes from causing
     800                 * backwards compatibility breaks.
     801                 */
    776802                $this->assertArrayHasKey(
    777803                        'src',
     
    788814
    789815        /**
    790          * Test that galleries only contain images specified in the
     816         * Tests that galleries only contain images specified in the
    791817         * id attribute of their respective shortcode and block.
    792818         *
     
    797823         */
    798824        public function test_respects_shortcode_and_block_id_attributes() {
    799                 // Test the get_post_galleries() function in $html=false mode, with both shortcode and block galleries
     825                /*
     826                 * Test the get_post_galleries() function in `$html = false` mode,
     827                 * with both shortcode and block galleries.
     828                 */
    800829                $ids      = array();
    801830                $imgs     = array();
     
    849878
    850879        /**
    851          * Test that galleries contain the additional attributes
     880         * Tests that galleries contain the additional attributes
    852881         * specified for their respective shortcode and block.
    853882         *
     
    858887         */
    859888        public function test_respects_additional_shortcode_and_block_attributes() {
    860                 // Test attributes returned by get_post_galleries() function in $html=false mode, with both shortcode and block galleries
     889                /*
     890                 * Test attributes returned by get_post_galleries() function in `$html = false` mode,
     891                 * with both shortcode and block galleries.
     892                 */
    861893                $ids      = array();
    862894                $imgs     = array();
     
    896928                                array(
    897929                                        'ids'  => $ids1_joined,
    898                                         // The shortcode code passes arbitrary attributes
     930                                        // The shortcode code passes arbitrary attributes.
    899931                                        'type' => 'type',
    900932                                        'foo'  => 'bar',
     
    903935                                array(
    904936                                        'ids' => $ids2_joined,
    905                                         // The block only passes ids, no other attributes
     937                                        // The block only passes ids, no other attributes.
    906938                                        'src' => array_slice( $ids_srcs, 3, 3 ),
    907939                                ),
     
    913945
    914946        /**
    915          * Test that srcs are retrieved from the HTML of a block gallery
     947         * Tests that srcs are retrieved from the HTML of a block gallery
    916948         * that has no JSON blob.
    917949         *
     
    959991                );
    960992
    961                 // The method can return an array of strings
    962                 // instead of an array of arrays.
     993                /*
     994                 * The method can return an array of strings
     995                 * instead of an array of arrays.
     996                 */
    963997                $this->assertIsArray(
    964998                        $galleries[0],
     
    9661000                );
    9671001
    968                 // This prevents future changes from causing
    969                 // backwards compatibility breaks.
     1002                /*
     1003                 * This prevents future changes from causing
     1004                 * backwards compatibility breaks.
     1005                 */
    9701006                $this->assertArrayHasKey(
    9711007                        'src',
     
    9821018
    9831019        /**
    984          * Test that srcs are returned for a block gallery nested within
     1020         * Tests that srcs are returned for a block gallery nested within
    9851021         * other blocks.
    9861022         *
     
    10231059                );
    10241060
    1025                 // The method can return an array of strings
    1026                 // instead of an array of arrays.
     1061                /*
     1062                 * The method can return an array of strings
     1063                 * instead of an array of arrays.
     1064                 */
    10271065                $this->assertIsArray(
    10281066                        $galleries[0],
     
    10301068                );
    10311069
    1032                 // This prevents future changes from causing
    1033                 // backwards compatibility breaks.
     1070                /*
     1071                 * This prevents future changes from causing
     1072                 * backwards compatibility breaks.
     1073                 */
    10341074                $this->assertArrayHasKey(
    10351075                        'src',
Note: See TracChangeset for help on using the changeset viewer.