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'])); }