From 0a95950fee84f3eea6bec77f52df634529a1e694 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Tue, 19 May 2026 19:28:03 +0800 Subject: [PATCH] Fix Unsubscribe Tests --- tests/Integration/APITest.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/Integration/APITest.php b/tests/Integration/APITest.php index 0ad858e..1620130 100644 --- a/tests/Integration/APITest.php +++ b/tests/Integration/APITest.php @@ -4245,15 +4245,15 @@ public function testUpdateSubscriberWithInvalidSubscriberID() */ public function testUnsubscribeByEmail() { - // Avoid a rate limit due to previous tests. - sleep(2); - // Add a subscriber. $emailAddress = $this->generateEmailAddress(); $result = $this->api->create_subscriber($emailAddress); $this->assertNotInstanceOf(\WP_Error::class, $result); $this->assertIsArray($result); + // Wait a moment to ensure subscriber is created. + sleep(3); + // Unsubscribe. $this->assertNull($this->api->unsubscribe_by_email($emailAddress)); } @@ -4301,6 +4301,9 @@ public function testUnsubscribe() $this->assertNotInstanceOf(\WP_Error::class, $result); $this->assertIsArray($result); + // Wait a moment to ensure subscriber is created. + sleep(3); + // Unsubscribe. $this->assertNull($this->api->unsubscribe($result['subscriber']['id'])); }