Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/phpunit/tests/query/generatePostdata.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function test_authordata() {
$data = generate_postdata( $p );

$this->assertNotEmpty( $data['authordata'] );
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( $u, $data['authordata'] );
}

Expand Down
10 changes: 10 additions & 0 deletions tests/phpunit/tests/query/isTerm.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function test_tag_action_tax() {
$this->assertNotEmpty( get_query_var( 'taxonomy' ) );
$this->assertNotEmpty( get_query_var( 'term_id' ) );
$this->assertNotEmpty( get_query_var( 'tag_id' ) );
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( get_queried_object(), $this->tag );
}

Expand All @@ -80,6 +81,7 @@ public function test_tag_query_cat_action_tax() {
$this->assertNotEmpty( get_query_var( 'term_id' ) );
$this->assertNotEmpty( get_query_var( 'cat' ) );
$this->assertNotEmpty( get_query_var( 'tag_id' ) );
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( get_queried_object(), $this->cat );
}

Expand All @@ -93,6 +95,7 @@ public function test_tag_query_cat_query_tax_action_tax() {
$this->assertNotEmpty( get_query_var( 'cat' ) );
$this->assertNotEmpty( get_query_var( 'tag_id' ) );
$this->assertNotEmpty( get_query_var( 'testtax' ) );
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( get_queried_object(), $this->cat );
}

Expand All @@ -104,6 +107,7 @@ public function test_cat_action_tax() {
$this->assertNotEmpty( get_query_var( 'tax_query' ) );
$this->assertNotEmpty( get_query_var( 'taxonomy' ) );
$this->assertNotEmpty( get_query_var( 'term_id' ) );
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( get_queried_object(), $this->cat );
}

Expand All @@ -120,6 +124,7 @@ public function test_cat_uncat_action_tax() {
$this->assertNotEmpty( get_query_var( 'tax_query' ) );
$this->assertNotEmpty( get_query_var( 'taxonomy' ) );
$this->assertNotEmpty( get_query_var( 'term_id' ) );
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( get_queried_object(), $this->uncat );

remove_action( 'pre_get_posts', array( $this, 'cat_uncat_action_tax' ), 11 );
Expand All @@ -130,6 +135,7 @@ public function cat_uncat_action_tax( &$query ) {
$this->assertTrue( $query->is_archive() );
$this->assertNotEmpty( $query->get( 'category_name' ) );
$this->assertNotEmpty( $query->get( 'tax_query' ) );
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( $query->get_queried_object(), $this->uncat );
}

Expand All @@ -143,6 +149,7 @@ public function test_tax_action_tax() {
$this->assertNotEmpty( get_query_var( 'tax_query' ) );
$this->assertNotEmpty( get_query_var( 'taxonomy' ) );
$this->assertNotEmpty( get_query_var( 'term_id' ) );
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( get_queried_object(), get_term( $this->tax_id, 'testtax' ) );
}

Expand All @@ -154,6 +161,7 @@ public function test_tax_query_tag_action_tax() {
$this->assertNotEmpty( get_query_var( 'taxonomy' ) );
$this->assertNotEmpty( get_query_var( 'term_id' ) );
$this->assertNotEmpty( get_query_var( 'tag_id' ) );
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( get_queried_object(), $this->tag );
}

Expand All @@ -165,6 +173,7 @@ public function test_tax_query_cat_action_tax() {
$this->assertNotEmpty( get_query_var( 'taxonomy' ) );
$this->assertNotEmpty( get_query_var( 'term_id' ) );
$this->assertNotEmpty( get_query_var( 'cat' ) );
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( get_queried_object(), $this->cat );
}

Expand Down Expand Up @@ -206,6 +215,7 @@ public function test_get_queried_object_with_custom_taxonomy_tax_query_and_field

$expected = get_term( $this->tax_id, 'testtax' );

// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( $expected, $object );
}

Expand Down
4 changes: 4 additions & 0 deletions tests/phpunit/tests/query/setupPostdata.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function test_authordata() {
setup_postdata( $p );

$this->assertNotEmpty( $GLOBALS['authordata'] );
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( $u, $GLOBALS['authordata'] );
}

Expand Down Expand Up @@ -111,6 +112,7 @@ public function test_secondary_query_post_vars() {

// Main loop.
$this->assertSame( $post1->ID, $GLOBALS['id'] );
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( get_userdata( $users[0] ), $GLOBALS['authordata'] );
$this->assertSame( '02.02.12', $GLOBALS['currentday'] );
$this->assertSame( '02', $GLOBALS['currentmonth'] );
Expand All @@ -130,6 +132,7 @@ public function test_secondary_query_post_vars() {

// Should refer to the current loop.
$this->assertSame( $post2->ID, $GLOBALS['id'] );
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( get_userdata( $users[1] ), $GLOBALS['authordata'] );
$this->assertSame( '03.03.13', $GLOBALS['currentday'] );
$this->assertSame( '03', $GLOBALS['currentmonth'] );
Expand All @@ -139,6 +142,7 @@ public function test_secondary_query_post_vars() {

// Should be reset to main loop.
$this->assertSame( $post1->ID, $GLOBALS['id'] );
// Keep assertEquals() because the objects are intentionally compared by value.
$this->assertEquals( get_userdata( $users[0] ), $GLOBALS['authordata'] );
$this->assertSame( '02.02.12', $GLOBALS['currentday'] );
$this->assertSame( '02', $GLOBALS['currentmonth'] );
Expand Down
Loading