Make WordPress Core

Changeset 50384


Ignore:
Timestamp:
02/18/2021 12:02:42 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Tests: Rename stick_post() and unstick_post() tests for a bit more clarity.

Add missing DocBlock for test_unstick_post_updates_option().

Follow-up to [50380].

See #52007.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post.php

    r50380 r50384  
    16401640
    16411641        /**
    1642          * Ensure sticking post updates option.
     1642         * Ensure sticking a post updates the `sticky_posts` option.
    16431643         *
    16441644         * @covers ::stick_post
    16451645         */
    1646         function test_sticky_posts() {
     1646        function test_stick_post_updates_option() {
    16471647                stick_post( 1 );
    16481648                $this->assertSameSets( array( 1 ), get_option( 'sticky_posts' ) );
    … …  
    16531653
    16541654        /**
    1655          * Ensure sticking posts can not duplicate options.
     1655         * Ensure sticking a post does not duplicate post IDs in the option.
    16561656         *
    16571657         * @ticket 52007
    16581658         * @covers ::stick_post
    1659          * @dataProvider data_sticky_posts_not_duplicate_with_the_same_value
     1659         * @dataProvider data_stick_post_does_not_duplicate_post_ids
    16601660         *
    16611661         * @param mixed $stick Value to pass to stick_post().
    16621662         */
    1663         function test_sticky_posts_not_duplicate_with_the_same_value( $stick ) {
     1663        function test_stick_post_does_not_duplicate_post_ids( $stick ) {
    16641664                update_option( 'sticky_posts', array( 1, 2 ) );
    16651665
    … …  
    16691669
    16701670        /**
    1671          * Data provider for test_sticky_posts_not_duplicate_with_the_same_value().
     1671         * Data provider for test_stick_post_does_not_duplicate_post_ids().
    16721672         *
    16731673         * @return array[] {
    … …  
    16771677         * }
    16781678         */
    1679         function data_sticky_posts_not_duplicate_with_the_same_value() {
     1679        function data_stick_post_does_not_duplicate_post_ids() {
    16801680                return array(
    16811681                        array( 1 ),
    … …  
    16861686
    16871687        /**
    1688          * Ensure sticking post removes other duplicates.
     1688         * Ensure sticking a post removes other duplicate post IDs from the option.
    16891689         *
    16901690         * @ticket 52007
    … …  
    16931693         * @param mixed $stick Value to pass to stick_post().
    16941694         */
    1695         function test_sticky_posts_remove_duplicate_ids_when_add_new_value() {
     1695        function test_stick_post_removes_duplicate_post_ids_when_adding_new_value() {
    16961696                update_option( 'sticky_posts', array( 1, 1, 2, 2 ) );
    16971697
    … …  
    17001700        }
    17011701
    1702         function test_unsticky_posts() {
     1702        /**
     1703         * Ensure unsticking a post updates the `sticky_posts` option.
     1704         *
     1705         * @covers ::unstick_post
     1706         */
     1707        function test_unstick_post_updates_option() {
    17031708                update_option( 'sticky_posts', array( 1 ) );
    17041709                unstick_post( 1 );
    … …  
    17111716
    17121717        /**
    1713          * Ensure duplicates removed when unsticking posts.
     1718         * Ensure unsticking a post removes duplicate post IDs from the option.
    17141719         *
    17151720         * @ticket 52007
    17161721         * @covers ::unstick_post
    17171722         *
    1718          * @dataProvider data_unstick_posts_with_duplicate_id
     1723         * @dataProvider data_unstick_post_removes_duplicate_post_ids
    17191724         *
    17201725         * @param array $starting_option Original value of `sticky_posts` option.
    … …  
    17221727         * @param array $expected
    17231728         */
    1724         function test_unstick_posts_with_duplicate_id( $starting_option, $unstick, $expected ) {
     1729        function test_unstick_post_removes_duplicate_post_ids( $starting_option, $unstick, $expected ) {
    17251730                update_option( 'sticky_posts', $starting_option );
    17261731                unstick_post( $unstick );
    … …  
    17291734
    17301735        /**
    1731          * Data provider for test_unstick_posts_with_duplicate_id
     1736         * Data provider for test_unstick_post_removes_duplicate_post_ids().
    17321737         *
    17331738         * @return array[] {
    … …  
    17391744         * }
    17401745         */
    1741         function data_unstick_posts_with_duplicate_id() {
     1746        function data_unstick_post_removes_duplicate_post_ids() {
    17421747                return array(
    17431748                        array(
    … …  
    17701775
    17711776        /**
    1772          * Ensure sticking duplicate does not trigger db update.
     1777         * Ensure sticking a duplicate post does not update the `sticky_posts` option.
    17731778         *
    17741779         * @ticket 52007
    17751780         * @covers ::stick_post
    17761781         */
    1777         function test_sticking_dupes_does_not_trigger_update() {
     1782        function test_stick_post_with_duplicate_post_id_does_not_update_option() {
    17781783                update_option( 'sticky_posts', array( 1, 2, 2 ) );
    17791784                stick_post( 2 );
    … …  
    17821787
    17831788        /**
    1784          * Ensure unsticking unstuck post does not trigger db update.
     1789         * Ensure unsticking a non-sticky post does not update the `sticky_posts` option.
    17851790         *
    17861791         * @ticket 52007
    17871792         * @covers ::unstick_post
    17881793         */
    1789         function test_unsticking_unstuck_post_does_not_trigger_update() {
     1794        function test_unstick_post_with_non_sticky_post_id_does_not_update_option() {
    17901795                update_option( 'sticky_posts', array( 1, 2, 2 ) );
    17911796                unstick_post( 3 );
Note: See TracChangeset for help on using the changeset viewer.