Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions tests/ConvertKitAPITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3581,29 +3581,23 @@ public function testCreateSubscriberWithInvalidSubscriberState()
}

/**
* Test that create_subscriber() returns the expected data
* when an invalid custom field is included.
* Test that create_subscriber() throws a ClientException when an invalid
* custom field is included.
*
* @since 2.0.0
*
* @return void
*/
public function testCreateSubscriberWithInvalidCustomFields()
{

$this->expectException(ClientException::class);
$emailAddress = $this->generateEmailAddress();
$result = $this->api->create_subscriber(
email_address: $emailAddress,
fields: [
'not_a_custom_field' => 'value'
]
);

// 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);
}

/**
Expand Down
Loading