Unit Tests: create fewer terms in `Tests_Term_getTerms::test_get_terms_parent_zero()`

See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35196 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-10-15 06:52:19 +00:00
parent 65390cd9cf
commit 32719bf251
2 changed files with 9 additions and 11 deletions

View File

@ -332,15 +332,15 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
// check the long form // check the long form
$types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
foreach ($types as $type) { foreach ($types as $type) {
$this->go_to("/category/cat-a/feed/{$type}"); $this->go_to("/category/cat-a/feed/{$type}");
$this->assertQueryTrue('is_archive', 'is_feed', 'is_category'); $this->assertQueryTrue('is_archive', 'is_feed', 'is_category');
} }
// check the short form // check the short form
$types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
foreach ($types as $type) { foreach ($types as $type) {
$this->go_to("/category/cat-a/{$type}"); $this->go_to("/category/cat-a/{$type}");
$this->assertQueryTrue('is_archive', 'is_feed', 'is_category'); $this->assertQueryTrue('is_archive', 'is_feed', 'is_category');
} }
} }

View File

@ -286,12 +286,10 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
$this->assertEquals( 2, $term->count ); $this->assertEquals( 2, $term->count );
$brie = $this->factory->term->create( array( 'name' => 'Brie', 'parent' => $cheese, 'taxonomy' => $tax ) ); $brie = $this->factory->term->create( array( 'name' => 'Brie', 'parent' => $cheese, 'taxonomy' => $tax ) );
$post_ids = $this->factory->post->create_many( 7 ); $post_id = $this->factory->post->create();
foreach ( $post_ids as $id ) { wp_set_post_terms( $post_id, $brie, $tax );
wp_set_post_terms( $id, $brie, $tax );
}
$term = get_term( $brie, $tax ); $term = get_term( $brie, $tax );
$this->assertEquals( 7, $term->count ); $this->assertEquals( 1, $term->count );
$crackers = $this->factory->term->create( array( 'name' => 'Crackers', 'taxonomy' => $tax ) ); $crackers = $this->factory->term->create( array( 'name' => 'Crackers', 'taxonomy' => $tax ) );
@ -304,12 +302,12 @@ class Tests_Term_getTerms extends WP_UnitTestCase {
$this->assertEquals( 1, $term->count ); $this->assertEquals( 1, $term->count );
$multigrain = $this->factory->term->create( array( 'name' => 'Multigrain', 'parent' => $crackers, 'taxonomy' => $tax ) ); $multigrain = $this->factory->term->create( array( 'name' => 'Multigrain', 'parent' => $crackers, 'taxonomy' => $tax ) );
$post_ids = $this->factory->post->create_many( 3 ); $post_ids = $this->factory->post->create_many( 1 );
foreach ( $post_ids as $id ) { foreach ( $post_ids as $id ) {
wp_set_post_terms( $id, $multigrain, $tax ); wp_set_post_terms( $id, $multigrain, $tax );
} }
$term = get_term( $multigrain, $tax ); $term = get_term( $multigrain, $tax );
$this->assertEquals( 3, $term->count ); $this->assertEquals( 1, $term->count );
$fruit = $this->factory->term->create( array( 'name' => 'Fruit', 'taxonomy' => $tax ) ); $fruit = $this->factory->term->create( array( 'name' => 'Fruit', 'taxonomy' => $tax ) );
$cranberries = $this->factory->term->create( array( 'name' => 'Cranberries', 'parent' => $fruit, 'taxonomy' => $tax ) ); $cranberries = $this->factory->term->create( array( 'name' => 'Cranberries', 'parent' => $fruit, 'taxonomy' => $tax ) );