Changeset 50384
- Timestamp:
- 02/18/2021 12:02:42 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post.php
r50380 r50384 1640 1640 1641 1641 /** 1642 * Ensure sticking post updatesoption.1642 * Ensure sticking a post updates the `sticky_posts` option. 1643 1643 * 1644 1644 * @covers ::stick_post 1645 1645 */ 1646 function test_stick y_posts() {1646 function test_stick_post_updates_option() { 1647 1647 stick_post( 1 ); 1648 1648 $this->assertSameSets( array( 1 ), get_option( 'sticky_posts' ) ); … … 1653 1653 1654 1654 /** 1655 * Ensure sticking posts can not duplicate options.1655 * Ensure sticking a post does not duplicate post IDs in the option. 1656 1656 * 1657 1657 * @ticket 52007 1658 1658 * @covers ::stick_post 1659 * @dataProvider data_stick y_posts_not_duplicate_with_the_same_value1659 * @dataProvider data_stick_post_does_not_duplicate_post_ids 1660 1660 * 1661 1661 * @param mixed $stick Value to pass to stick_post(). 1662 1662 */ 1663 function test_stick y_posts_not_duplicate_with_the_same_value( $stick ) {1663 function test_stick_post_does_not_duplicate_post_ids( $stick ) { 1664 1664 update_option( 'sticky_posts', array( 1, 2 ) ); 1665 1665 … … 1669 1669 1670 1670 /** 1671 * Data provider for test_stick y_posts_not_duplicate_with_the_same_value().1671 * Data provider for test_stick_post_does_not_duplicate_post_ids(). 1672 1672 * 1673 1673 * @return array[] { … … 1677 1677 * } 1678 1678 */ 1679 function data_stick y_posts_not_duplicate_with_the_same_value() {1679 function data_stick_post_does_not_duplicate_post_ids() { 1680 1680 return array( 1681 1681 array( 1 ), … … 1686 1686 1687 1687 /** 1688 * Ensure sticking post removes other duplicates.1688 * Ensure sticking a post removes other duplicate post IDs from the option. 1689 1689 * 1690 1690 * @ticket 52007 … … 1693 1693 * @param mixed $stick Value to pass to stick_post(). 1694 1694 */ 1695 function test_stick y_posts_remove_duplicate_ids_when_add_new_value() {1695 function test_stick_post_removes_duplicate_post_ids_when_adding_new_value() { 1696 1696 update_option( 'sticky_posts', array( 1, 1, 2, 2 ) ); 1697 1697 … … 1700 1700 } 1701 1701 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() { 1703 1708 update_option( 'sticky_posts', array( 1 ) ); 1704 1709 unstick_post( 1 ); … … 1711 1716 1712 1717 /** 1713 * Ensure duplicates removed when unsticking posts.1718 * Ensure unsticking a post removes duplicate post IDs from the option. 1714 1719 * 1715 1720 * @ticket 52007 1716 1721 * @covers ::unstick_post 1717 1722 * 1718 * @dataProvider data_unstick_post s_with_duplicate_id1723 * @dataProvider data_unstick_post_removes_duplicate_post_ids 1719 1724 * 1720 1725 * @param array $starting_option Original value of `sticky_posts` option. … … 1722 1727 * @param array $expected 1723 1728 */ 1724 function test_unstick_post s_with_duplicate_id( $starting_option, $unstick, $expected ) {1729 function test_unstick_post_removes_duplicate_post_ids( $starting_option, $unstick, $expected ) { 1725 1730 update_option( 'sticky_posts', $starting_option ); 1726 1731 unstick_post( $unstick ); … … 1729 1734 1730 1735 /** 1731 * Data provider for test_unstick_post s_with_duplicate_id1736 * Data provider for test_unstick_post_removes_duplicate_post_ids(). 1732 1737 * 1733 1738 * @return array[] { … … 1739 1744 * } 1740 1745 */ 1741 function data_unstick_post s_with_duplicate_id() {1746 function data_unstick_post_removes_duplicate_post_ids() { 1742 1747 return array( 1743 1748 array( … … 1770 1775 1771 1776 /** 1772 * Ensure sticking duplicate does not trigger db update.1777 * Ensure sticking a duplicate post does not update the `sticky_posts` option. 1773 1778 * 1774 1779 * @ticket 52007 1775 1780 * @covers ::stick_post 1776 1781 */ 1777 function test_stick ing_dupes_does_not_trigger_update() {1782 function test_stick_post_with_duplicate_post_id_does_not_update_option() { 1778 1783 update_option( 'sticky_posts', array( 1, 2, 2 ) ); 1779 1784 stick_post( 2 ); … … 1782 1787 1783 1788 /** 1784 * Ensure unsticking unstuck post does not trigger db update.1789 * Ensure unsticking a non-sticky post does not update the `sticky_posts` option. 1785 1790 * 1786 1791 * @ticket 52007 1787 1792 * @covers ::unstick_post 1788 1793 */ 1789 function test_unstick ing_unstuck_post_does_not_trigger_update() {1794 function test_unstick_post_with_non_sticky_post_id_does_not_update_option() { 1790 1795 update_option( 'sticky_posts', array( 1, 2, 2 ) ); 1791 1796 unstick_post( 3 );
Note: See TracChangeset
for help on using the changeset viewer.