From 1ff5d457795f599615c8a88fcaf19145f47ef1b7 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Fri, 15 May 2026 20:05:42 +0800 Subject: [PATCH] Tests: Fix `testCreateSubscriberWithInvalidCustomFields` --- tests/Integration/APITest.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/Integration/APITest.php b/tests/Integration/APITest.php index 688f95b..0ad858e 100644 --- a/tests/Integration/APITest.php +++ b/tests/Integration/APITest.php @@ -3924,7 +3924,7 @@ public function testCreateSubscriberWithInvalidSubscriberState() } /** - * Test that create_subscriber() returns the expected data + * Test that create_subscriber() returns a WP_Error * when an invalid custom field is included. * * @since 2.0.0 @@ -3940,14 +3940,8 @@ public function testCreateSubscriberWithInvalidCustomFields() 'not_a_custom_field' => 'value', ] ); - $this->assertNotInstanceOf(\WP_Error::class, $result); - $this->assertIsArray($result); - - // Set subscriber_id to ensure subscriber is unsubscribed after test. - $this->subscriber_ids[] = $result['subscriber']['id']; - - // Assert subscriber exists with correct data. - $this->assertEquals($result['subscriber']['email_address'], $emailAddress); + $this->assertInstanceOf(\WP_Error::class, $result); + $this->assertEquals($result->get_error_code(), $this->errorCode); } /**