Skip to content

Commit e6ee56b

Browse files
committed
Tests: Use assertWPError() in taxonomy tests.
Use the dedicated assertion helper for expected `WP_Error` results, preserving the existing test behavior and assertion messages. Developed in: #14559 Props shailu25. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@64642 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d2720e7 commit e6ee56b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎tests/phpunit/tests/taxonomy.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public function test_register_taxonomy_return_value() {
242242
* @expectedIncorrectUsage register_taxonomy
243243
*/
244244
public function test_register_taxonomy_with_too_long_name() {
245-
$this->assertInstanceOf( 'WP_Error', register_taxonomy( 'abcdefghijklmnopqrstuvwxyz0123456789', 'post', array() ) );
245+
$this->assertWPError( register_taxonomy( 'abcdefghijklmnopqrstuvwxyz0123456789', 'post', array() ) );
246246
}
247247

248248
/**
@@ -251,7 +251,7 @@ public function test_register_taxonomy_with_too_long_name() {
251251
* @expectedIncorrectUsage register_taxonomy
252252
*/
253253
public function test_register_taxonomy_with_empty_name() {
254-
$this->assertInstanceOf( 'WP_Error', register_taxonomy( '', 'post', array() ) );
254+
$this->assertWPError( register_taxonomy( '', 'post', array() ) );
255255
}
256256

257257
/**
@@ -359,7 +359,7 @@ public function test_register_taxonomy_for_post_type_for_taxonomy_with_no_object
359359

360360
public function test_get_objects_in_term_should_return_invalid_taxonomy_error() {
361361
$terms = get_objects_in_term( 1, 'invalid_taxonomy' );
362-
$this->assertInstanceOf( 'WP_Error', $terms );
362+
$this->assertWPError( $terms );
363363
$this->assertSame( 'invalid_taxonomy', $terms->get_error_code() );
364364
}
365365

@@ -496,7 +496,7 @@ public function test_insert_category_force_error_handle() {
496496
'taxonomy' => 'force_error',
497497
'cat_name' => 'Error',
498498
);
499-
$this->assertInstanceOf( 'WP_Error', wp_insert_category( $cat, true ) );
499+
$this->assertWPError( wp_insert_category( $cat, true ) );
500500
}
501501

502502
public function test_insert_category_force_error_no_handle() {

0 commit comments

Comments
 (0)