Skip to content

Commit 3d3a7eb

Browse files
committed
Tests: Use error assertions in Customizer nav menu tests.
Use `assertWPError()` in the Customizer navigation menu tests. Preserve the existing error-code and successful-result assertions. Developed in: #14570 Props shailu25. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@64653 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b2a3f52 commit 3d3a7eb

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎tests/phpunit/tests/customize/nav-menus.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ public function test_load_available_items_query_returns_wp_error() {
128128

129129
// Invalid post type $obj_name.
130130
$items = $menus->load_available_items_query( 'post_type', 'invalid' );
131-
$this->assertInstanceOf( 'WP_Error', $items );
131+
$this->assertWPError( $items );
132132
$this->assertSame( 'nav_menus_invalid_post_type', $items->get_error_code() );
133133

134134
// Invalid taxonomy $obj_name.
135135
$items = $menus->load_available_items_query( 'taxonomy', 'invalid' );
136-
$this->assertInstanceOf( 'WP_Error', $items );
136+
$this->assertWPError( $items );
137137
$this->assertSame( 'invalid_taxonomy', $items->get_error_code() );
138138
}
139139

@@ -686,7 +686,7 @@ public function test_insert_auto_draft_post() {
686686
$menus = new WP_Customize_Nav_Menus( $this->wp_customize );
687687

688688
$r = $menus->insert_auto_draft_post( array() );
689-
$this->assertInstanceOf( 'WP_Error', $r );
689+
$this->assertWPError( $r );
690690
$this->assertSame( 'unknown_post_type', $r->get_error_code() );
691691

692692
// Non-existent post types allowed as of #39610.
@@ -700,7 +700,7 @@ public function test_insert_auto_draft_post() {
700700
$this->assertSame( $this->wp_customize->changeset_uuid(), get_post_meta( $r->ID, '_customize_changeset_uuid', true ) );
701701

702702
$r = $menus->insert_auto_draft_post( array( 'post_type' => 'post' ) );
703-
$this->assertInstanceOf( 'WP_Error', $r );
703+
$this->assertWPError( $r );
704704
$this->assertSame( 'empty_title', $r->get_error_code() );
705705

706706
$r = $menus->insert_auto_draft_post(
@@ -710,7 +710,7 @@ public function test_insert_auto_draft_post() {
710710
'post_type' => 'post',
711711
)
712712
);
713-
$this->assertInstanceOf( 'WP_Error', $r );
713+
$this->assertWPError( $r );
714714
$this->assertSame( 'status_forbidden', $r->get_error_code() );
715715

716716
$r = $menus->insert_auto_draft_post(

0 commit comments

Comments
 (0)