Changeset 31287
- Timestamp:
- 01/28/2015 08:42:25 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r31285 r31287 3784 3784 $object_terms = array(); 3785 3785 foreach ( (array) $terms as $term ) 3786 $object_terms[$term->object_id][$term->taxonomy][ $term->term_id] = $term;3786 $object_terms[$term->object_id][$term->taxonomy][] = $term; 3787 3787 3788 3788 foreach ( $ids as $id ) { -
trunk/tests/phpunit/tests/term.php
r31230 r31287 1586 1586 1587 1587 /** 1588 * @ticket 31086 1589 */ 1590 public function test_get_the_terms_should_return_zero_indexed_array_when_cache_is_empty() { 1591 register_taxonomy( 'wptests_tax', 'post' ); 1592 $p = $this->factory->post->create(); 1593 wp_set_object_terms( $p, array( 'foo', 'bar' ), 'wptests_tax' ); 1594 1595 $found = get_the_terms( $p, 'wptests_tax' ); 1596 1597 $this->assertEqualSets( array( 0, 1 ), array_keys( $found ) ); 1598 } 1599 1600 /** 1601 * @ticket 31086 1602 */ 1603 public function test_get_the_terms_should_return_zero_indexed_array_when_cache_is_primed() { 1604 register_taxonomy( 'wptests_tax', 'post' ); 1605 $p = $this->factory->post->create(); 1606 wp_set_object_terms( $p, array( 'foo', 'bar' ), 'wptests_tax' ); 1607 1608 // Prime cache. 1609 update_object_term_cache( array( $p ), array( 'post' ) ); 1610 1611 $found = get_the_terms( $p, 'wptests_tax' ); 1612 1613 $this->assertEqualSets( array( 0, 1 ), array_keys( $found ) ); 1614 } 1615 1616 /** 1588 1617 * @ticket 19205 1589 1618 */
Note: See TracChangeset
for help on using the changeset viewer.