mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( isset( ... ) )` with `assertArrayHasKey()` to use native PHPUnit functionality. Follow-up to [51335], [51337], [51367]. See #53363. git-svn-id: https://develop.svn.wordpress.org/trunk@51397 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -104,14 +104,14 @@ class Tests_Term_GetTerm extends WP_UnitTestCase {
|
||||
$t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) );
|
||||
$term = get_term( $t, 'wptests_tax', ARRAY_A );
|
||||
$this->assertIsArray( $term );
|
||||
$this->assertTrue( isset( $term['term_id'] ) );
|
||||
$this->assertArrayHasKey( 'term_id', $term );
|
||||
}
|
||||
|
||||
public function test_output_array_n() {
|
||||
$t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) );
|
||||
$term = get_term( $t, 'wptests_tax', ARRAY_N );
|
||||
$this->assertIsArray( $term );
|
||||
$this->assertFalse( isset( $term['term_id'] ) );
|
||||
$this->assertArrayNotHasKey( 'term_id', $term );
|
||||
foreach ( $term as $k => $v ) {
|
||||
$this->assertIsInt( $k );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user