Make WordPress Core

Changeset 53512


Ignore:
Timestamp:
06/15/2022 07:32:25 PM (4 years ago)
Author:
spacedmonkey
Message:

Tests: Re-enable failing REST API test for update_post_parent_caches().

Ensure that that attachment objects are not primed in cache so that test passes when object caching is enabled.

Follow-up to [53506].

Props SergeyBiryukov.
See #55593.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php

    r53511 r53512  
    15581558         */
    15591559        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(
     1560                $parent_id1       = self::$post_ids[0];
     1561                $parent_id2       = self::$post_ids[1];
     1562                $parent_ids       = array( $parent_id1, $parent_id2 );
     1563                $attachment_ids   = array();
     1564                $attachment_ids[] = $this->factory->attachment->create_object(
    15651565                        DIR_TESTDATA . '/images/canola.jpg',
    15661566                        $parent_id1,
     
    15711571                );
    15721572
    1573                 $this->factory->attachment->create_object(
     1573                $attachment_ids[] = $this->factory->attachment->create_object(
    15741574                        DIR_TESTDATA . '/images/canola.jpg',
    15751575                        $parent_id2,
     
    15821582                // Attachment creation warms parent IDs. Needs clean up for test.
    15831583                wp_cache_delete_multiple( $parent_ids, 'posts' );
     1584                wp_cache_delete_multiple( $attachment_ids, 'posts' );
    15841585
    15851586                $filter = new MockAction();
     
    15921593                $last = end( $args );
    15931594                $this->assertIsArray( $last, 'The last value is not an array' );
    1594                 // TODO: Enable this once the test is updated to pass with persistent object cache.
    1595                 // $this->assertSameSets( $parent_ids, $last[1] );
     1595                $this->assertSameSets( $parent_ids, $last[1] );
    15961596        }
    15971597
Note: See TracChangeset for help on using the changeset viewer.