[wp-trac] [WordPress Trac] #25711: The "{$taxonomy}_children" cache can become stale

WordPress Trac noreply at wordpress.org
Thu Feb 13 00:17:02 UTC 2014


#25711: The "{$taxonomy}_children" cache can become stale
------------------------------+-----------------------
 Reporter:  dd32              |       Owner:
     Type:  defect (bug)      |      Status:  reopened
 Priority:  normal            |   Milestone:  3.9
Component:  Taxonomy          |     Version:  3.8
 Severity:  normal            |  Resolution:
 Keywords:  needs-unit-tests  |     Focuses:
------------------------------+-----------------------
Changes (by bpetty):

 * keywords:   => needs-unit-tests
 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 I'm not sure exactly what values should be tested for here, so I'm not
 going to attempt a patch, but this does need some eyes on the unit tests
 again at least.

 {{{
 1) Tests_Term_Cache::test_category_children_cache
 Failed asserting that two arrays are equal.
 --- Expected
 +++ Actual
 @@ @@
  Array (
 -    75 => Array (...)
  )

 /vagrant/wordpress/tests/phpunit/tests/term/cache.php:22
 }}}

 Here's the assertion:

 {{{
 $this->assertEquals( array( $term_id1 => array( $term_id1_child ) ),
 $hierarchy );
 }}}

 I've only see this fail on PHP 5.2, however, what I'd like to specifically
 point out is that this is comparing the result fetched from the factory,
 which should contain row IDs, and likely a bunch more data that is both
 irrelevant to this test, and is also volatile (can easily change between
 runs just like the ID does depending on previous tests run - try running
 full tests compared to just --group taxonomy).

 This really needs to be rewritten with more more specific values used for
 assertion checks. Try to avoid using arrays, they can frequently fail when
 just out of order (but still remain functional and correct).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/25711#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list