diff --git a/tests/Integration/APITest.php b/tests/Integration/APITest.php index ad34182..0ad858e 100644 --- a/tests/Integration/APITest.php +++ b/tests/Integration/APITest.php @@ -1379,11 +1379,11 @@ public function testGetFormSubscriptionsWithTotalCount() * * @return void */ - public function testGetFormSubscriptionsWithBouncedSubscriberState() + public function testGetFormSubscriptionsWithCancelledSubscriberState() { $result = $this->api->get_form_subscriptions( form_id: (int) $_ENV['CONVERTKIT_API_FORM_ID'], - subscriber_state: 'bounced' + subscriber_state: 'cancelled' ); // Assert subscribers and pagination exist. @@ -1391,7 +1391,7 @@ public function testGetFormSubscriptionsWithBouncedSubscriberState() $this->assertPaginationExists($result); // Check the correct subscribers were returned. - $this->assertEquals($result['subscribers'][0]['state'], 'bounced'); + $this->assertEquals($result['subscribers'][0]['state'], 'cancelled'); } /** @@ -2374,11 +2374,11 @@ public function testGetSequenceSubscriptionsWithTotalCount() * * @return void */ - public function testGetSequenceSubscriptionsWithBouncedSubscriberState() + public function testGetSequenceSubscriptionsWithCancelledSubscriberState() { $result = $this->api->get_sequence_subscriptions( sequence_id: $_ENV['CONVERTKIT_API_SEQUENCE_ID'], - subscriber_state: 'bounced' + subscriber_state: 'cancelled' ); // Assert subscribers and pagination exist. @@ -2386,7 +2386,7 @@ public function testGetSequenceSubscriptionsWithBouncedSubscriberState() $this->assertPaginationExists($result); // Check the correct subscribers were returned. - $this->assertEquals($result['subscribers'][0]['state'], 'bounced'); + $this->assertEquals($result['subscribers'][0]['state'], 'cancelled'); } /** @@ -3213,11 +3213,11 @@ public function testGetTagSubscriptionsWithTotalCount() * * @return void */ - public function testGetTagSubscriptionsWithBouncedSubscriberState() + public function testGetTagSubscriptionsWithCancelledSubscriberState() { $result = $this->api->get_tag_subscriptions( tag_id: (int) $_ENV['CONVERTKIT_API_TAG_ID'], - subscriber_state: 'bounced' + subscriber_state: 'cancelled' ); // Assert subscribers and pagination exist. @@ -3225,7 +3225,7 @@ public function testGetTagSubscriptionsWithBouncedSubscriberState() $this->assertPaginationExists($result); // Check the correct subscribers were returned. - $this->assertEquals($result['subscribers'][0]['state'], 'bounced'); + $this->assertEquals($result['subscribers'][0]['state'], 'cancelled'); } @@ -3486,16 +3486,16 @@ public function testGetSubscribersByEmailAddress() /** * Test that get_subscribers() returns the expected data - * when the subscription status is bounced. + * when the subscription status is cancelled. * * @since 1.0.0 * * @return void */ - public function testGetSubscribersWithBouncedSubscriberState() + public function testGetSubscribersWithCancelledSubscriberState() { $result = $this->api->get_subscribers( - subscriber_state: 'bounced' + subscriber_state: 'cancelled' ); // Assert subscribers and pagination exist. @@ -3503,7 +3503,7 @@ public function testGetSubscribersWithBouncedSubscriberState() $this->assertPaginationExists($result); // Check the correct subscribers were returned. - $this->assertEquals($result['subscribers'][0]['state'], 'bounced'); + $this->assertEquals($result['subscribers'][0]['state'], 'cancelled'); } /** @@ -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); } /**