Changeset 53509
- Timestamp:
- 06/15/2022 02:07:24 PM (3 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/nav-menu.php
r53508 r53509 205 205 /** 206 206 * @ticket 55620 207 * @covers update_menu_item_cache208 */ 209 public function test_update_menu_item_cache_prime d_posts() {207 * @covers ::update_menu_item_cache 208 */ 209 public function test_update_menu_item_cache_primes_posts() { 210 210 $post_id = self::factory()->post->create(); 211 211 wp_update_nav_menu_item( … … 236 236 /** 237 237 * @ticket 55620 238 * @covers update_menu_item_cache239 */ 240 public function test_update_menu_item_cache_prime d_terms() {238 * @covers ::update_menu_item_cache 239 */ 240 public function test_update_menu_item_cache_primes_terms() { 241 241 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 242 242 $term_id = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); -
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r53507 r53509 1518 1518 * @ticket 55592 1519 1519 * @covers WP_REST_Posts_Controller::get_items 1520 * @covers ::update_post_thumbnail_cache 1520 1521 */ 1521 public function test_get_items_ with_featured_media() {1522 public function test_get_items_primes_thumbnail_cache_for_featured_media() { 1522 1523 $file = DIR_TESTDATA . '/images/canola.jpg'; 1523 1524 $attachment_ids = array(); … … 1535 1536 } 1536 1537 1537 // Attachment creation warms thumbnail ids. Needs clean up for test.1538 // Attachment creation warms thumbnail IDs. Needs clean up for test. 1538 1539 wp_cache_delete_multiple( $attachment_ids, 'posts' ); 1539 1540 … … 1549 1550 $this->assertIsArray( $last, 'The last value is not an array' ); 1550 1551 $this->assertEqualSets( $attachment_ids, $last[1] ); 1552 } 1553 1554 /** 1555 * @ticket 55593 1556 * @covers WP_REST_Posts_Controller::get_items 1557 * @covers ::update_post_parent_caches 1558 */ 1559 public function test_get_items_primes_parent_post_caches() { 1560 $parent_id1 = self::$post_ids[0]; 1561 $parent_id2 = self::$post_ids[1]; 1562 $parent_ids = array( $parent_id2, $parent_id1 ); 1563 1564 $this->factory->attachment->create_object( 1565 DIR_TESTDATA . '/images/canola.jpg', 1566 $parent_id1, 1567 array( 1568 'post_mime_type' => 'image/jpeg', 1569 'post_excerpt' => 'A sample caption 1', 1570 ) 1571 ); 1572 1573 $this->factory->attachment->create_object( 1574 DIR_TESTDATA . '/images/canola.jpg', 1575 $parent_id2, 1576 array( 1577 'post_mime_type' => 'image/jpeg', 1578 'post_excerpt' => 'A sample caption 2', 1579 ) 1580 ); 1581 1582 // Attachment creation warms parent IDs. Needs clean up for test. 1583 wp_cache_delete_multiple( $parent_ids, 'posts' ); 1584 1585 $filter = new MockAction(); 1586 add_filter( 'update_post_metadata_cache', array( $filter, 'filter' ), 10, 2 ); 1587 1588 $request = new WP_REST_Request( 'GET', '/wp/v2/media' ); 1589 rest_get_server()->dispatch( $request ); 1590 1591 $args = $filter->get_args(); 1592 $last = end( $args ); 1593 $this->assertIsArray( $last, 'The last value is not an array' ); 1594 $this->assertEqualSets( $parent_ids, $last[1] ); 1551 1595 } 1552 1596 … … 1786 1830 1787 1831 $this->assertSame( $formats, $data['schema']['properties']['format']['enum'] ); 1788 }1789 1790 /**1791 * @ticket 555931792 * @covers WP_REST_Posts_Controller::get_items1793 * @covers update_post_parent_caches1794 */1795 public function test_get_items_parent_ids_primed() {1796 $parent_id1 = self::$post_ids[0];1797 $parent_id2 = self::$post_ids[1];1798 $parent_ids = array( $parent_id2, $parent_id1 );1799 1800 $this->factory->attachment->create_object(1801 DIR_TESTDATA . '/images/canola.jpg',1802 $parent_id1,1803 array(1804 'post_mime_type' => 'image/jpeg',1805 'post_excerpt' => 'A sample caption 1',1806 )1807 );1808 1809 $this->factory->attachment->create_object(1810 DIR_TESTDATA . '/images/canola.jpg',1811 $parent_id2,1812 array(1813 'post_mime_type' => 'image/jpeg',1814 'post_excerpt' => 'A sample caption 2',1815 )1816 );1817 1818 // Attachment creation warms parent ids. Needs clean up for test.1819 wp_cache_delete_multiple( $parent_ids, 'posts' );1820 1821 $filter = new MockAction();1822 add_filter( 'update_post_metadata_cache', array( $filter, 'filter' ), 10, 2 );1823 1824 $request = new WP_REST_Request( 'GET', '/wp/v2/media' );1825 rest_get_server()->dispatch( $request );1826 1827 $args = $filter->get_args();1828 $last = end( $args );1829 $this->assertIsArray( $last, 'The last value is not an array' );1830 $this->assertEqualSets( $parent_ids, $last[1] );1831 1832 } 1832 1833
Note: See TracChangeset
for help on using the changeset viewer.