diff --git a/.env.dist.testing b/.env.dist.testing index 18ab5f7..55b75c9 100644 --- a/.env.dist.testing +++ b/.env.dist.testing @@ -27,7 +27,7 @@ CONVERTKIT_API_LANDING_PAGE_URL="https://cheerful-architect-3237.ck.page/99f1db6 CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_ID="2849151" CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_URL="https://cheerful-architect-3237.ck.page/cc5eb21744" CONVERTKIT_API_LEGACY_LANDING_PAGE_ID="470103" -CONVERTKIT_API_LEGACY_LANDING_PAGE_URL="https://app.convertkit.com/landing_pages/470103" +CONVERTKIT_API_LEGACY_LANDING_PAGE_URL="https://app.kit.com/landing_pages/470103" CONVERTKIT_API_POST_ID="3175837" CONVERTKIT_API_PRODUCT_ID="36377" CONVERTKIT_API_SEQUENCE_ID="1030824" diff --git a/.env.example b/.env.example index 4e150e1..3dd7952 100644 --- a/.env.example +++ b/.env.example @@ -33,7 +33,7 @@ CONVERTKIT_API_LANDING_PAGE_URL="https://cheerful-architect-3237.ck.page/99f1db6 CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_ID="2849151" CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_URL="https://cheerful-architect-3237.ck.page/cc5eb21744" CONVERTKIT_API_LEGACY_LANDING_PAGE_ID="470103" -CONVERTKIT_API_LEGACY_LANDING_PAGE_URL="https://app.convertkit.com/landing_pages/470103" +CONVERTKIT_API_LEGACY_LANDING_PAGE_URL="https://app.kit.com/landing_pages/470103" CONVERTKIT_API_POST_ID="3175837" CONVERTKIT_API_PRODUCT_ID="36377" CONVERTKIT_API_SEQUENCE_ID="1030824" diff --git a/composer.json b/composer.json index 10c99ff..c998af9 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "authors": [ { "name": "ConvertKit", - "email": "support@convertkit.com" + "email": "support@kit.com" } ], "type": "library", diff --git a/src/class-convertkit-api-traits.php b/src/class-convertkit-api-traits.php index 2973a15..02bc0e3 100644 --- a/src/class-convertkit-api-traits.php +++ b/src/class-convertkit-api-traits.php @@ -36,14 +36,14 @@ trait ConvertKit_API_Traits * * @var string */ - protected $oauth_authorize_url = 'https://app.convertkit.com/oauth/authorize'; + protected $oauth_authorize_url = 'https://app.kit.com/oauth/authorize'; /** * OAuth Token URL * * @var string */ - protected $oauth_token_url = 'https://api.convertkit.com/oauth/token'; + protected $oauth_token_url = 'https://api.kit.com/oauth/token'; /** * Version of ConvertKit API @@ -57,13 +57,13 @@ trait ConvertKit_API_Traits * * @var string */ - protected $api_url_base = 'https://api.convertkit.com/'; + protected $api_url_base = 'https://api.kit.com/'; /** * Gets the current account * - * @see https://developers.convertkit.com/v4.html#get-current-account + * @see https://developers.kit.com/v4.html#get-current-account * * @return WP_Error|array */ @@ -75,7 +75,7 @@ public function get_account() /** * Gets the account's colors * - * @see https://developers.convertkit.com/v4.html#list-colors + * @see https://developers.kit.com/v4.html#list-colors * * @return WP_Error|array */ @@ -89,7 +89,7 @@ public function get_account_colors() * * @param array $colors Hex colors. * - * @see https://developers.convertkit.com/v4.html#list-colors + * @see https://developers.kit.com/v4.html#list-colors * * @return WP_Error|array */ @@ -104,7 +104,7 @@ public function update_account_colors(array $colors) /** * Gets the Creator Profile * - * @see https://developers.convertkit.com/v4.html#get-creator-profile + * @see https://developers.kit.com/v4.html#get-creator-profile * * @return WP_Error|array */ @@ -116,7 +116,7 @@ public function get_creator_profile() /** * Gets email stats * - * @see https://developers.convertkit.com/v4.html#get-email-stats + * @see https://developers.kit.com/v4.html#get-email-stats * * @return WP_Error|array */ @@ -131,7 +131,7 @@ public function get_email_stats() * @param \DateTime $starting Gets stats for time period beginning on this date. Defaults to 90 days ago. * @param \DateTime $ending Gets stats for time period ending on this date. Defaults to today. * - * @see https://developers.convertkit.com/v4.html#get-growth-stats + * @see https://developers.kit.com/v4.html#get-growth-stats * * @return WP_Error|array */ @@ -157,7 +157,7 @@ public function get_growth_stats(\DateTime $starting = null, \DateTime $ending = * * @since 1.0.0 * - * @see https://developers.convertkit.com/v4.html#convertkit-api-forms + * @see https://developers.kit.com/v4.html#convertkit-api-forms * * @return WP_Error|array */ @@ -194,7 +194,7 @@ public function get_forms( * * @since 1.0.0 * - * @see https://developers.convertkit.com/v4.html#convertkit-api-forms + * @see https://developers.kit.com/v4.html#convertkit-api-forms * * @return WP_Error|array */ @@ -226,7 +226,7 @@ public function get_landing_pages( * @param integer $form_id Form ID. * @param string $email_address Email Address. * - * @see https://developers.convertkit.com/v4.html#add-subscriber-to-form-by-email-address + * @see https://developers.kit.com/v4.html#add-subscriber-to-form-by-email-address * * @return WP_Error|array */ @@ -244,7 +244,7 @@ public function add_subscriber_to_form_by_email(int $form_id, string $email_addr * @param integer $form_id Form ID. * @param integer $subscriber_id Subscriber ID. * - * @see https://developers.convertkit.com/v4.html#add-subscriber-to-form + * @see https://developers.kit.com/v4.html#add-subscriber-to-form * * @since 2.0.0 * @@ -284,7 +284,7 @@ public function add_subscriber_to_legacy_form(int $form_id, int $subscriber_id) * @param string $before_cursor Return results before the given pagination cursor. * @param integer $per_page Number of results to return. * - * @see https://developers.convertkit.com/v4.html#list-subscribers-for-a-form + * @see https://developers.kit.com/v4.html#list-subscribers-for-a-form * * @return WP_Error|array */ @@ -340,7 +340,7 @@ public function get_form_subscriptions( * @param string $before_cursor Return results before the given pagination cursor. * @param integer $per_page Number of results to return. * - * @see https://developers.convertkit.com/v4.html#list-sequences + * @see https://developers.kit.com/v4.html#list-sequences * * @return WP_Error|array */ @@ -368,7 +368,7 @@ public function get_sequences( * @param integer $sequence_id Sequence ID. * @param string $email_address Email Address. * - * @see https://developers.convertkit.com/v4.html#add-subscriber-to-sequence-by-email-address + * @see https://developers.kit.com/v4.html#add-subscriber-to-sequence-by-email-address * * @return WP_Error|array */ @@ -386,7 +386,7 @@ public function add_subscriber_to_sequence_by_email(int $sequence_id, string $em * @param integer $sequence_id Sequence ID. * @param integer $subscriber_id Subscriber ID. * - * @see https://developers.convertkit.com/v4.html#add-subscriber-to-sequence + * @see https://developers.kit.com/v4.html#add-subscriber-to-sequence * * @since 2.0.0 * @@ -411,7 +411,7 @@ public function add_subscriber_to_sequence(int $sequence_id, int $subscriber_id) * @param string $before_cursor Return results before the given pagination cursor. * @param integer $per_page Number of results to return. * - * @see https://developers.convertkit.com/v4.html#list-subscribers-for-a-sequence + * @see https://developers.kit.com/v4.html#list-subscribers-for-a-sequence * * @return WP_Error|array */ @@ -467,7 +467,7 @@ public function get_sequence_subscriptions( * @param string $before_cursor Return results before the given pagination cursor. * @param integer $per_page Number of results to return. * - * @see https://developers.convertkit.com/v4.html#list-tags + * @see https://developers.kit.com/v4.html#list-tags * * @return WP_Error|array */ @@ -496,7 +496,7 @@ public function get_tags( * * @since 1.0.0 * - * @see https://developers.convertkit.com/v4.html#create-a-tag + * @see https://developers.kit.com/v4.html#create-a-tag * * @return WP_Error|array */ @@ -516,7 +516,7 @@ public function create_tag(string $tag) * * @since 1.1.0 * - * @see https://developers.convertkit.com/v4.html#bulk-create-tags + * @see https://developers.kit.com/v4.html#bulk-create-tags * * @return WP_Error|array */ @@ -549,7 +549,7 @@ public function create_tags(array $tags, string $callback_url = '') * @param integer $tag_id Tag ID. * @param string $email_address Email Address. * - * @see https://developers.convertkit.com/v4.html#tag-a-subscriber-by-email-address + * @see https://developers.kit.com/v4.html#tag-a-subscriber-by-email-address * * @return WP_Error|array */ @@ -567,7 +567,7 @@ public function tag_subscriber_by_email(int $tag_id, string $email_address) * @param integer $tag_id Tag ID. * @param integer $subscriber_id Subscriber ID. * - * @see https://developers.convertkit.com/v4.html#tag-a-subscriber + * @see https://developers.kit.com/v4.html#tag-a-subscriber * * @return WP_Error|array */ @@ -584,7 +584,7 @@ public function tag_subscriber(int $tag_id, int $subscriber_id) * * @since 1.0.0 * - * @see https://developers.convertkit.com/v4.html#remove-tag-from-subscriber + * @see https://developers.kit.com/v4.html#remove-tag-from-subscriber * * @return WP_Error|array */ @@ -601,7 +601,7 @@ public function remove_tag_from_subscriber(int $tag_id, int $subscriber_id) * * @since 1.0.0 * - * @see https://developers.convertkit.com/v4.html#remove-tag-from-subscriber-by-email-address + * @see https://developers.kit.com/v4.html#remove-tag-from-subscriber-by-email-address * * @return WP_Error|array */ @@ -627,7 +627,7 @@ public function remove_tag_from_subscriber_by_email(int $tag_id, string $email_a * @param string $before_cursor Return results before the given pagination cursor. * @param integer $per_page Number of results to return. * - * @see https://developers.convertkit.com/v4.html#list-subscribers-for-a-tag + * @see https://developers.kit.com/v4.html#list-subscribers-for-a-tag * * @return WP_Error|array */ @@ -685,7 +685,7 @@ public function get_tag_subscriptions( * * @since 2.0.0 * - * @see https://developers.convertkit.com/v4.html#convertkit-api-email-templates + * @see https://developers.kit.com/v4.html#convertkit-api-email-templates * * @return WP_Error|array */ @@ -726,7 +726,7 @@ public function get_email_templates( * * @since 2.0.0 * - * @see https://developers.convertkit.com/v4.html#list-subscribers + * @see https://developers.kit.com/v4.html#list-subscribers * * @return WP_Error|array */ @@ -799,7 +799,7 @@ public function get_subscribers( * * @since 2.0.0 * - * @see https://developers.convertkit.com/v4.html#create-a-subscriber + * @see https://developers.kit.com/v4.html#create-a-subscriber * * @return mixed */ @@ -837,7 +837,7 @@ public function create_subscriber( * * @since 2.0.0 * - * @see https://developers.convertkit.com/v4.html#bulk-create-subscribers + * @see https://developers.kit.com/v4.html#bulk-create-subscribers * * @return mixed */ @@ -865,7 +865,7 @@ public function create_subscribers(array $subscribers, string $callback_url = '' * * @throws \InvalidArgumentException If the email address is not a valid email format. * - * @see https://developers.convertkit.com/v4.html#get-a-subscriber + * @see https://developers.kit.com/v4.html#get-a-subscriber * * @return bool|WP_Error|integer */ @@ -889,7 +889,7 @@ public function get_subscriber_id(string $email_address) * * @param integer $subscriber_id Subscriber ID. * - * @see https://developers.convertkit.com/v4.html#get-a-subscriber + * @see https://developers.kit.com/v4.html#get-a-subscriber * * @return bool|WP_Error|array */ @@ -906,7 +906,7 @@ public function get_subscriber(int $subscriber_id) * @param string $email_address New Email Address. * @param array $fields Updated Custom Fields. * - * @see https://developers.convertkit.com/v4.html#update-a-subscriber + * @see https://developers.kit.com/v4.html#update-a-subscriber * * @return WP_Error|array */ @@ -941,7 +941,7 @@ public function update_subscriber( * * @param string $email_address Email Address. * - * @see https://developers.convertkit.com/v4.html#unsubscribe-subscriber + * @see https://developers.kit.com/v4.html#unsubscribe-subscriber * * @return bool|WP_Error|array */ @@ -960,7 +960,7 @@ public function unsubscribe_by_email(string $email_address) * * @param integer $subscriber_id Subscriber ID. * - * @see https://developers.convertkit.com/v4.html#unsubscribe-subscriber + * @see https://developers.kit.com/v4.html#unsubscribe-subscriber * * @return bool|WP_Error|array */ @@ -978,7 +978,7 @@ public function unsubscribe(int $subscriber_id) * @param string $before_cursor Return results before the given pagination cursor. * @param integer $per_page Number of results to return. * - * @see https://developers.convertkit.com/v4.html#list-tags-for-a-subscriber + * @see https://developers.kit.com/v4.html#list-tags-for-a-subscriber * * @return WP_Error|array */ @@ -1009,7 +1009,7 @@ public function get_subscriber_tags( * @param string $before_cursor Return results before the given pagination cursor. * @param integer $per_page Number of results to return. * - * @see https://developers.convertkit.com/v4.html#list-broadcasts + * @see https://developers.kit.com/v4.html#list-broadcasts * * @return WP_Error|array */ @@ -1055,7 +1055,7 @@ public function get_broadcasts( * @param string $preview_text Specify the preview text of the email. * @param array $subscriber_filter Filter subscriber(s) to send the email to. * - * @see https://developers.convertkit.com/v4.html#create-a-broadcast + * @see https://developers.kit.com/v4.html#create-a-broadcast * * @return bool|WP_Error|array */ @@ -1114,7 +1114,7 @@ public function create_broadcast( * * @param integer $id Broadcast ID. * - * @see https://developers.convertkit.com/v4.html#get-a-broadcast + * @see https://developers.kit.com/v4.html#get-a-broadcast * * @return bool|WP_Error|array */ @@ -1129,7 +1129,7 @@ public function get_broadcast(int $id) * * @param integer $id Broadcast ID. * - * @see https://developers.convertkit.com/v4.html#get-stats + * @see https://developers.kit.com/v4.html#get-stats * * @return bool|WP_Error|array */ @@ -1162,7 +1162,7 @@ public function get_broadcast_stats(int $id) * @param string $preview_text Specify the preview text of the email. * @param array $subscriber_filter Filter subscriber(s) to send the email to. * - * @see https://developers.convertkit.com/#create-a-broadcast + * @see https://developers.kit.com/#create-a-broadcast * * @return bool|WP_Error|array */ @@ -1224,7 +1224,7 @@ public function update_broadcast( * * @since 1.0.0 * - * @see https://developers.convertkit.com/v4.html#delete-a-broadcast + * @see https://developers.kit.com/v4.html#delete-a-broadcast * * @return bool|WP_Error|array */ @@ -1243,7 +1243,7 @@ public function delete_broadcast(int $id) * * @since 2.0.0 * - * @see https://developers.convertkit.com/v4.html#list-webhooks + * @see https://developers.kit.com/v4.html#list-webhooks * * @return WP_Error|array */ @@ -1275,7 +1275,7 @@ public function get_webhooks( * * @since 1.0.0 * - * @see https://developers.convertkit.com/v4.html#create-a-webhook + * @see https://developers.kit.com/v4.html#create-a-webhook * * @throws \InvalidArgumentException If the event is not supported. * @@ -1351,7 +1351,7 @@ public function create_webhook(string $url, string $event, string $parameter = ' * * @since 1.0.0 * - * @see https://developers.convertkit.com/v4.html#delete-a-webhook + * @see https://developers.kit.com/v4.html#delete-a-webhook * * @return bool|WP_Error|array */ @@ -1370,7 +1370,7 @@ public function delete_webhook(int $id) * * @since 1.0.0 * - * @see https://developers.convertkit.com/v4.html#list-custom-fields + * @see https://developers.kit.com/v4.html#list-custom-fields * * @return WP_Error|array */ @@ -1400,7 +1400,7 @@ public function get_custom_fields( * * @since 1.0.0 * - * @see https://developers.convertkit.com/v4.html#create-a-custom-field + * @see https://developers.kit.com/v4.html#create-a-custom-field * * @return bool|WP_Error|array */ @@ -1420,7 +1420,7 @@ public function create_custom_field(string $label) * * @since 1.0.0 * - * @see https://developers.convertkit.com/v4.html#bulk-create-custom-fields + * @see https://developers.kit.com/v4.html#bulk-create-custom-fields * * @return bool|WP_Error|array */ @@ -1455,7 +1455,7 @@ public function create_custom_fields(array $labels, string $callback_url = '') * * @since 1.0.0 * - * @see https://developers.convertkit.com/v4.html#update-a-custom-field + * @see https://developers.kit.com/v4.html#update-a-custom-field * * @return bool|WP_Error|array */ @@ -1474,7 +1474,7 @@ public function update_custom_field(int $id, string $label) * * @since 1.0.0 * - * @see https://developers.convertkit.com/#destroy-field + * @see https://developers.kit.com/#destroy-field * * @return bool|WP_Error|array */ @@ -1493,7 +1493,7 @@ public function delete_custom_field(int $id) * * @since 1.0.0 * - * @see https://developers.convertkit.com/v4.html#list-purchases + * @see https://developers.kit.com/v4.html#list-purchases * * @return WP_Error|array */ @@ -1521,7 +1521,7 @@ public function get_purchases( * * @param integer $purchase_id Purchase ID. * - * @see https://developers.convertkit.com/v4.html#get-a-purchase + * @see https://developers.kit.com/v4.html#get-a-purchase * * @return bool|WP_Error|array */ @@ -1546,7 +1546,7 @@ public function get_purchase(int $purchase_id) * @param float $total Total. * @param \DateTime $transaction_time Transaction date and time. * - * @see https://developers.convertkit.com/v4.html#create-a-purchase + * @see https://developers.kit.com/v4.html#create-a-purchase * * @return bool|WP_Error|array */ @@ -1608,7 +1608,7 @@ public function create_purchase( * * @since 2.0.0 * - * @see https://developers.convertkit.com/v4.html#convertkit-api-segments + * @see https://developers.kit.com/v4.html#convertkit-api-segments * * @return WP_Error|array */ diff --git a/src/class-convertkit-api-v4.php b/src/class-convertkit-api-v4.php index 07b8bfd..0de99e4 100644 --- a/src/class-convertkit-api-v4.php +++ b/src/class-convertkit-api-v4.php @@ -81,7 +81,7 @@ class ConvertKit_API_V4 { /** * ConvertKit API endpoints that use the /oauth/ namespace - * i.e. https://api.convertkit.com/oauth/endpoint + * i.e. https://api.kit.com/oauth/endpoint * * @since 2.0.0 * @@ -93,7 +93,7 @@ class ConvertKit_API_V4 { /** * ConvertKit API endpoints that use the /wordpress/ namespace - * i.e. https://api.convertkit.com/wordpress/endpoint + * i.e. https://api.kit.com/wordpress/endpoint * * @since 1.3.0 * @@ -602,7 +602,7 @@ public function sequence_subscribe( $sequence_id, $email, $first_name = '', $cus * * @param string $email_address Email Address. * - * @see https://developers.convertkit.com/v4.html#get-a-subscriber + * @see https://developers.kit.com/v4.html#get-a-subscriber * * @return WP_Error|false|integer */ @@ -631,7 +631,7 @@ public function get_subscriber_id( string $email_address ) { * * @param string $email_address Email Address. * - * @see https://developers.convertkit.com/v4.html#unsubscribe-subscriber + * @see https://developers.kit.com/v4.html#unsubscribe-subscriber * * @return WP_Error|false|object */ @@ -1106,7 +1106,7 @@ public function get_form_html( $id, $api_key = '' ) { 'k' => $api_key, 'v' => 2, ), - 'https://api.convertkit.com/forms/' . $id . '/embed' + 'https://api.kit.com/forms/' . $id . '/embed' ); // Get HTML. @@ -1221,7 +1221,7 @@ public function get_html( $url, $body_only = true ) { $body = wp_remote_retrieve_body( $result ); // If the body appears to be JSON containing an error, the request for a Legacy Form - // through api.convertkit.com failed, so return a WP_Error now. + // through api.kit.com failed, so return a WP_Error now. if ( $this->is_json( $body ) ) { $json = json_decode( $body ); return new WP_Error( @@ -1695,7 +1695,7 @@ private function get_user_agent() { private function get_api_url( $endpoint ) { // For some specific API endpoints created primarily for the WordPress Plugin, the API base is - // https://api.convertkit.com/wordpress/$endpoint. + // https://api.kit.com/wordpress/$endpoint. // We perform a string search instead of in_array(), because the $endpoint might be e.g. // profile/{subscriber_id} or subscriber_authentication/send_code. foreach ( $this->api_endpoints_wordpress as $wordpress_endpoint ) { @@ -1704,14 +1704,14 @@ private function get_api_url( $endpoint ) { } } - // For oAuth API endpoints, the API base is https://api.convertkit.com/oauth/$endpoint. + // For oAuth API endpoints, the API base is https://api.kit.com/oauth/$endpoint. foreach ( $this->api_endpoints_oauth as $oauth_endpoint ) { if ( strpos( $endpoint, $oauth_endpoint ) !== false ) { return path_join( $this->api_url_base . 'oauth', $endpoint ); } } - // For all other endpoints, it's https://api.convertkit.com/v4/$endpoint. + // For all other endpoints, it's https://api.kit.com/v4/$endpoint. return path_join( $this->api_url_base . $this->api_version, $endpoint ); } diff --git a/src/class-convertkit-review-request.php b/src/class-convertkit-review-request.php index eb9a868..8eeed17 100644 --- a/src/class-convertkit-review-request.php +++ b/src/class-convertkit-review-request.php @@ -275,7 +275,7 @@ public function get_review_url() { */ public function get_support_url() { - return 'https://convertkit.com/support'; + return 'https://kit.com/support'; } diff --git a/tests/_support/Helper/WPUnit/API.php b/tests/_support/Helper/WPUnit/API.php index e4cbc53..732d736 100644 --- a/tests/_support/Helper/WPUnit/API.php +++ b/tests/_support/Helper/WPUnit/API.php @@ -32,7 +32,7 @@ public function apiRequest($endpoint, $method = 'GET', $params = array()) $client = new \GuzzleHttp\Client(); $result = $client->request( $method, - 'https://api.convertkit.com/v3/' . $endpoint . '?' . http_build_query($params), + 'https://api.kit.com/v3/' . $endpoint . '?' . http_build_query($params), [ 'headers' => [ 'Accept-Encoding' => 'gzip', diff --git a/tests/wpunit/APITest.php b/tests/wpunit/APITest.php index 2b8e3eb..e6797d2 100644 --- a/tests/wpunit/APITest.php +++ b/tests/wpunit/APITest.php @@ -320,7 +320,7 @@ public function testGetOAuthURL() // Confirm the OAuth URL returned is correct. $this->assertEquals( $this->api->get_oauth_url(), - 'https://app.convertkit.com/oauth/authorize?' . http_build_query( + 'https://app.kit.com/oauth/authorize?' . http_build_query( [ 'client_id' => $_ENV['CONVERTKIT_OAUTH_CLIENT_ID'], 'response_type' => 'code', @@ -345,7 +345,7 @@ public function testGetOAuthURLWithState() // Confirm the OAuth URL returned is correct. $this->assertEquals( $this->api->get_oauth_url( 'https://example.com' ), - 'https://app.convertkit.com/oauth/authorize?' . http_build_query( + 'https://app.kit.com/oauth/authorize?' . http_build_query( [ 'client_id' => $_ENV['CONVERTKIT_OAUTH_CLIENT_ID'], 'response_type' => 'code', @@ -3734,10 +3734,10 @@ public function testCreateSubscribers() { $subscribers = [ [ - 'email_address' => str_replace('@convertkit.com', '-1@convertkit.com', $this->generateEmailAddress()), + 'email_address' => str_replace('@kit.com', '-1@kit.com', $this->generateEmailAddress()), ], [ - 'email_address' => str_replace('@convertkit.com', '-2@convertkit.com', $this->generateEmailAddress()), + 'email_address' => str_replace('@kit.com', '-2@kit.com', $this->generateEmailAddress()), ], ]; $result = $this->api->create_subscribers($subscribers); @@ -4058,7 +4058,7 @@ public function testUnsubscribeByEmail() */ public function testUnsubscribeByEmailWithNotSubscribedEmailAddress() { - $result = $this->api->unsubscribe_by_email('not-subscribed@convertkit.com'); + $result = $this->api->unsubscribe_by_email('not-subscribed@kit.com'); $this->assertInstanceOf(WP_Error::class, $result); } @@ -5584,7 +5584,7 @@ public function testSubscriberAuthenticationSendCodeWithSubscribedEmail() public function testSubscriberAuthenticationSendCodeWithNotSubscribedEmail() { $result = $this->api->subscriber_authentication_send_code( - 'email-not-subscribed@convertkit.com', + 'email-not-subscribed@kit.com', $_ENV['TEST_SITE_WP_URL'] ); $this->assertInstanceOf(WP_Error::class, $result); @@ -6213,7 +6213,8 @@ public function testGetLegacyLandingPageHTML() { $result = $this->api->get_landing_page_html($_ENV['CONVERTKIT_API_LEGACY_LANDING_PAGE_URL']); $this->assertNotInstanceOf(WP_Error::class, $result); - $this->assertStringContainsString('
', $result); + + $this->assertStringContainsString('', $result); // Check that rocket-loader.min.js has been removed, as including it breaks landing page redirects. $this->assertStringNotContainsString('rocket-loader.min.js', $result); @@ -6279,7 +6280,7 @@ function( $response ) use ( $httpCode, $httpMessage, $body ) { // phpcs:ignore G public function mockAccessTokenExpiredResponse( $response, $parsed_args, $url ) { // Only mock requests made to the /account endpoint. - if ( strpos( $url, 'https://api.convertkit.com/v4/account' ) === false ) { + if ( strpos( $url, 'https://api.kit.com/v4/account' ) === false ) { return $response; } @@ -6319,7 +6320,7 @@ public function mockAccessTokenExpiredResponse( $response, $parsed_args, $url ) public function mockRefreshTokenResponse( $response, $parsed_args, $url ) { // Only mock requests made to the /token endpoint. - if ( strpos( $url, 'https://api.convertkit.com/oauth/token' ) === false ) { + if ( strpos( $url, 'https://api.kit.com/oauth/token' ) === false ) { return $response; } @@ -6393,11 +6394,11 @@ private function assertPaginationExists($result) * * @since 2.0.0 * - * @param string $domain Domain (default: convertkit.com). + * @param string $domain Domain (default: kit.com). * * @return string */ - private function generateEmailAddress($domain = 'convertkit.com') + private function generateEmailAddress($domain = 'kit.com') { return 'php-sdk-' . date('Y-m-d-H-i-s') . '-php-' . PHP_VERSION_ID . '@' . $domain; } diff --git a/tests/wpunit/ResourceTest.php b/tests/wpunit/ResourceTest.php index fa830e9..d46c6b6 100644 --- a/tests/wpunit/ResourceTest.php +++ b/tests/wpunit/ResourceTest.php @@ -307,7 +307,7 @@ public function testRefreshForms() // did call both `get_forms` and `get_legacy_forms` methods. $this->assertArrayHasKey($_ENV['CONVERTKIT_API_LEGACY_FORM_ID'], $resources); $this->assertArrayHasKey('embed_url', $resources[ $_ENV['CONVERTKIT_API_LEGACY_FORM_ID'] ]); - $this->assertEquals('https://api.convertkit.com/api/v3/forms/' . $_ENV['CONVERTKIT_API_LEGACY_FORM_ID'] . '.html?api_key=' . $_ENV['CONVERTKIT_API_KEY'], $resources[ $_ENV['CONVERTKIT_API_LEGACY_FORM_ID'] ]['embed_url']); + $this->assertEquals('https://api.kit.com/api/v3/forms/' . $_ENV['CONVERTKIT_API_LEGACY_FORM_ID'] . '.html?api_key=' . $_ENV['CONVERTKIT_API_KEY'], $resources[ $_ENV['CONVERTKIT_API_LEGACY_FORM_ID'] ]['embed_url']); // Delete resources. $this->resource->delete();