Make WordPress Core

Ticket #55176: 55176.5.diff

File 55176.5.diff, 1.1 KB (added by azouamauriac, 3 years ago)

unit test

  • tests/phpunit/tests/post.php

     
    16861686        }
    16871687
    16881688        /**
     1689         * Ensure sticking a post after delete 'sticky_posts' option.
     1690         *
     1691         * @ticket 55176
     1692         * @covers ::stick_post
     1693         * @dataProvider data_stick_post_after_delete_sticky_posts_option
     1694         *
     1695         * @param mixed $stick Value to pass to stick_post().
     1696         */
     1697        public function test_stick_post_after_delete_sticky_posts_option( $stick ) {
     1698                delete_option('sticky_posts');
     1699
     1700                stick_post( $stick );
     1701                $this->assertSameSets( array( 1 ), get_option( 'sticky_posts' ) );
     1702        }
     1703
     1704        /**
     1705         * Data provider for test_stick_post_after_delete_sticky_posts_option().
     1706         *
     1707         * @return array[] {
     1708         *     Arguments passed to test.
     1709         *
     1710         *     @type mixed $stick Value to pass to stick_post().
     1711         * }
     1712         */
     1713        public function data_stick_post_after_delete_sticky_posts_option() {
     1714                return array(
     1715                        array( 1 ),
     1716                );
     1717        }
     1718
     1719        /**
    16891720         * Ensure sticking a post removes other duplicate post IDs from the option.
    16901721         *
    16911722         * @ticket 52007