Remove the Featured Content term filters when running Unit Tests. Set the return value of wp_get_object_terms() to a var before passing to array_shift() in test_get_object_terms_types(), which expects a var to be passed by reference.

See #25282.



git-svn-id: https://develop.svn.wordpress.org/trunk@26187 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2013-11-15 02:32:16 +00:00
parent 8c01596a75
commit 5de39fc2f1
3 changed files with 15 additions and 4 deletions

View File

@@ -8,6 +8,8 @@ class Tests_Term extends WP_UnitTestCase {
function setUp() {
parent::setUp();
_clean_term_filters();
// insert one term into every post taxonomy
// otherwise term_ids and term_taxonomy_ids might be identical, which could mask bugs
$term = rand_str();
@@ -441,12 +443,14 @@ class Tests_Term extends WP_UnitTestCase {
$term = wp_insert_term( 'one', $this->taxonomy );
wp_set_object_terms( $post_id, $term, $this->taxonomy );
$term = array_shift( wp_get_object_terms( $post_id, $this->taxonomy, array( 'fields' => 'all_with_object_id' ) ) );
$terms = wp_get_object_terms( $post_id, $this->taxonomy, array( 'fields' => 'all_with_object_id' ) );
$term = array_shift( $terms );
$int_fields = array( 'parent', 'term_id', 'count', 'term_group', 'term_taxonomy_id', 'object_id' );
foreach ( $int_fields as $field )
$this->assertInternalType( 'int', $term->$field, $field );
$term = array_shift( wp_get_object_terms( $post_id, $this->taxonomy, array( 'fields' => 'ids' ) ) );
$terms = wp_get_object_terms( $post_id, $this->taxonomy, array( 'fields' => 'ids' ) );
$term = array_shift( $terms );
$this->assertInternalType( 'int', $term, 'term' );
}