@@ -246,42 +246,6 @@ public function testCreateTags()
246246 ]);
247247 }
248248
249- /**
250- * Test that create_tags() throws a ClientException when attempting
251- * to create blank tags, as this is only supported using OAuth.
252- *
253- * @since 2.2.0
254- *
255- * @return void
256- */
257- public function testCreateTagsBlank ()
258- {
259- $ this ->expectException (ClientException::class);
260- $ result = $ this ->api ->create_tags ([
261- '' ,
262- '' ,
263- ]);
264- }
265-
266- /**
267- * Test that create_tags() throws a ClientException when creating
268- * tags that already exists, as this is only supported using OAuth.
269- *
270- * @since 2.2.0
271- *
272- * @return void
273- */
274- public function testCreateTagsThatExist ()
275- {
276- $ this ->expectException (ClientException::class);
277- $ result = $ this ->api ->create_tags (
278- [
279- $ _ENV ['CONVERTKIT_API_TAG_NAME ' ],
280- $ _ENV ['CONVERTKIT_API_TAG_NAME_2 ' ],
281- ]
282- );
283- }
284-
285249 /**
286250 * Test that add_subscribers_to_forms() throws a ClientException when
287251 * attempting to add subscribers to forms, as this is only supported
@@ -319,167 +283,6 @@ public function testAddSubscribersToForms()
319283 );
320284 }
321285
322- /**
323- * Test that add_subscribers_to_forms() returns a ClientException
324- * when a referrer URL is specified, as this is only supported
325- * using OAuth.
326- *
327- * @since 2.2.0
328- *
329- * @return void
330- */
331- public function testAddSubscribersToFormsWithReferrer ()
332- {
333- // Create subscriber.
334- $ emailAddress = $ this ->generateEmailAddress ();
335- $ subscriber = $ this ->api ->create_subscriber (
336- email_address: $ emailAddress
337- );
338-
339- // Set subscriber_id to ensure subscriber is unsubscribed after test.
340- $ this ->subscriber_ids [] = $ subscriber ->subscriber ->id ;
341-
342- $ this ->expectException (ClientException::class);
343-
344- // Add subscribers to forms.
345- $ result = $ this ->api ->add_subscribers_to_forms (
346- forms_subscribers_ids: [
347- [
348- 'form_id ' => (int ) $ _ENV ['CONVERTKIT_API_FORM_ID ' ],
349- 'subscriber_id ' => $ subscriber ->subscriber ->id ,
350- 'referrer ' => 'https://mywebsite.com/bfpromo/ ' ,
351- ],
352- [
353- 'form_id ' => (int ) $ _ENV ['CONVERTKIT_API_FORM_ID_2 ' ],
354- 'subscriber_id ' => $ subscriber ->subscriber ->id ,
355- 'referrer ' => 'https://mywebsite.com/bfpromo/ ' ,
356- ],
357- ]
358- );
359- }
360-
361- /**
362- * Test that add_subscribers_to_forms() returns a ClientException
363- * when a referrer URL with UTM parameters is specified, as this is only
364- * supported using OAuth.
365- *
366- * @since 2.2.0
367- *
368- * @return void
369- */
370- public function testAddSubscribersToFormsWithReferrerUTMParams ()
371- {
372- // Define referrer.
373- $ referrerUTMParams = [
374- 'utm_source ' => 'facebook ' ,
375- 'utm_medium ' => 'cpc ' ,
376- 'utm_campaign ' => 'black_friday ' ,
377- 'utm_term ' => 'car_owners ' ,
378- 'utm_content ' => 'get_10_off ' ,
379- ];
380- $ referrer = 'https://mywebsite.com/bfpromo/? ' . http_build_query ($ referrerUTMParams );
381-
382- // Create subscriber.
383- $ emailAddress = $ this ->generateEmailAddress ();
384- $ subscriber = $ this ->api ->create_subscriber (
385- email_address: $ emailAddress
386- );
387-
388- // Set subscriber_id to ensure subscriber is unsubscribed after test.
389- $ this ->subscriber_ids [] = $ subscriber ->subscriber ->id ;
390-
391- $ this ->expectException (ClientException::class);
392-
393- // Add subscribers to forms.
394- $ result = $ this ->api ->add_subscribers_to_forms (
395- forms_subscribers_ids: [
396- [
397- 'form_id ' => (int ) $ _ENV ['CONVERTKIT_API_FORM_ID ' ],
398- 'subscriber_id ' => $ subscriber ->subscriber ->id ,
399- 'referrer ' => $ referrer ,
400- ],
401- [
402- 'form_id ' => (int ) $ _ENV ['CONVERTKIT_API_FORM_ID_2 ' ],
403- 'subscriber_id ' => $ subscriber ->subscriber ->id ,
404- 'referrer ' => $ referrer ,
405- ],
406- ]
407- );
408- }
409-
410- /**
411- * Test that add_subscribers_to_forms() returns a ClientException
412- * when invalid Form IDs are specified, as this is only supported
413- * using OAuth.
414- *
415- * @since 2.2.0
416- *
417- * @return void
418- */
419- public function testAddSubscribersToFormsWithInvalidFormIDs ()
420- {
421- // Create subscriber.
422- $ emailAddress = $ this ->generateEmailAddress ();
423- $ subscriber = $ this ->api ->create_subscriber (
424- email_address: $ emailAddress
425- );
426-
427- // Set subscriber_id to ensure subscriber is unsubscribed after test.
428- $ this ->subscriber_ids [] = $ subscriber ->subscriber ->id ;
429-
430- $ this ->expectException (ClientException::class);
431-
432- // Add subscribers to forms.
433- $ result = $ this ->api ->add_subscribers_to_forms (
434- forms_subscribers_ids: [
435- [
436- 'form_id ' => 9999999 ,
437- 'subscriber_id ' => $ subscriber ->subscriber ->id ,
438- ],
439- [
440- 'form_id ' => 9999999 ,
441- 'subscriber_id ' => $ subscriber ->subscriber ->id ,
442- ],
443- ]
444- );
445- }
446-
447- /**
448- * Test that add_subscribers_to_forms() returns a ClientException
449- * when invalid Subscriber IDs are specified, as this is only supported
450- *
451- * @since 2.2.0
452- *
453- * @return void
454- */
455- public function testAddSubscribersToFormsWithInvalidSubscriberIDs ()
456- {
457- // Create subscriber.
458- $ emailAddress = $ this ->generateEmailAddress ();
459- $ subscriber = $ this ->api ->create_subscriber (
460- email_address: $ emailAddress
461- );
462-
463- // Set subscriber_id to ensure subscriber is unsubscribed after test.
464- $ this ->subscriber_ids [] = $ subscriber ->subscriber ->id ;
465-
466- $ this ->expectException (ClientException::class);
467-
468- // Add subscribers to forms.
469- $ result = $ this ->api ->add_subscribers_to_forms (
470- forms_subscribers_ids: [
471- [
472- 'form_id ' => (int ) $ _ENV ['CONVERTKIT_API_FORM_ID ' ],
473- 'subscriber_id ' => 999999 ,
474- ],
475- [
476- 'form_id ' => (int ) $ _ENV ['CONVERTKIT_API_FORM_ID_2 ' ],
477- 'subscriber_id ' => 999999 ,
478- ],
479- ]
480- );
481- }
482-
483286 /**
484287 * Test that create_subscribers() returns a ClientException
485288 * when attempting to create subscribers, as this is only supported
@@ -503,43 +306,6 @@ public function testCreateSubscribers()
503306 $ result = $ this ->api ->create_subscribers ($ subscribers );
504307 }
505308
506- /**
507- * Test that create_subscribers() throws a ClientException when no data is specified.
508- *
509- * @since 2.2.0
510- *
511- * @return void
512- */
513- public function testCreateSubscribersWithBlankData ()
514- {
515- $ this ->expectException (ClientException::class);
516- $ result = $ this ->api ->create_subscribers ([
517- [],
518- ]);
519- }
520-
521- /**
522- * Test that create_subscribers() throws a ClientException when invalid email addresses
523- * are specified, as this is only supported using OAuth.
524- *
525- * @since 2.2.0
526- *
527- * @return void
528- */
529- public function testCreateSubscribersWithInvalidEmailAddresses ()
530- {
531- $ this ->expectException (ClientException::class);
532- $ subscribers = [
533- [
534- 'email_address ' => 'not-an-email-address ' ,
535- ],
536- [
537- 'email_address ' => 'not-an-email-address-again ' ,
538- ],
539- ];
540- $ result = $ this ->api ->create_subscribers ($ subscribers );
541- }
542-
543309 /**
544310 * Test that create_custom_fields() throws a ClientException
545311 * as this is only supported using OAuth.
@@ -572,40 +338,6 @@ public function testGetPurchases()
572338 $ result = $ this ->api ->get_purchases ();
573339 }
574340
575- /**
576- * Test that get_purchases() throws a ClientException
577- * when the total count is included, as this is only
578- * supported using OAuth.
579- *
580- * @since 2.2.0
581- *
582- * @return void
583- */
584- public function testGetPurchasesWithTotalCount ()
585- {
586- $ this ->expectException (ClientException::class);
587- $ result = $ this ->api ->get_purchases (
588- include_total_count: true
589- );
590- }
591-
592- /**
593- * Test that get_purchases() throws a ClientException
594- * when pagination parameters and per_page limits are specified,
595- * as this is only supported using OAuth.
596- *
597- * @since 2.2.0
598- *
599- * @return void
600- */
601- public function testGetPurchasesPagination ()
602- {
603- $ this ->expectException (ClientException::class);
604- $ result = $ this ->api ->get_purchases (
605- per_page: 1
606- );
607- }
608-
609341 /**
610342 * Test that get_purchases() throws a ClientException
611343 * when a purchase ID is specified, as this is only
@@ -621,21 +353,6 @@ public function testGetPurchase()
621353 $ result = $ this ->api ->get_purchase (12345 );
622354 }
623355
624- /**
625- * Test that get_purchases() throws a ClientException when an invalid
626- * purchase ID is specified, as this is only supported
627- * using OAuth.
628- *
629- * @since 2.2.0
630- *
631- * @return void
632- */
633- public function testGetPurchaseWithInvalidID ()
634- {
635- $ this ->expectException (ClientException::class);
636- $ this ->api ->get_purchase (12345 );
637- }
638-
639356 /**
640357 * Test that create_purchase() throws a ClientException
641358 * as this is only supported using OAuth.
@@ -681,79 +398,4 @@ public function testCreatePurchase()
681398 transaction_time: new DateTime ('now ' ),
682399 );
683400 }
684-
685- /**
686- * Test that create_purchase() throws a ClientException when an invalid
687- * email address is specified, as this is only supported using OAuth.
688- *
689- * @since 2.2.0
690- *
691- * @return void
692- */
693- public function testCreatePurchaseWithInvalidEmailAddress ()
694- {
695- $ this ->expectException (ClientException::class);
696- $ this ->api ->create_purchase (
697- email_address: 'not-an-email-address ' ,
698- transaction_id: str_shuffle ('wfervdrtgsdewrafvwefds ' ),
699- currency: 'usd ' ,
700- products: [
701- [
702- 'name ' => 'Floppy Disk (512k) ' ,
703- 'sku ' => '7890-ijkl ' ,
704- 'pid ' => 9999 ,
705- 'lid ' => 7777 ,
706- 'quantity ' => 2 ,
707- 'unit_price ' => 5.00 ,
708- ],
709- ],
710- );
711- }
712-
713- /**
714- * Test that create_purchase() throws a ClientException when a blank
715- * transaction ID is specified, as this is only supported using OAuth.
716- *
717- * @since 2.2.0
718- *
719- * @return void
720- */
721- public function testCreatePurchaseWithBlankTransactionID ()
722- {
723- $ this ->expectException (ClientException::class);
724- $ this ->api ->create_purchase (
725- email_address: $ this ->generateEmailAddress (),
726- transaction_id: '' ,
727- currency: 'usd ' ,
728- products: [
729- [
730- 'name ' => 'Floppy Disk (512k) ' ,
731- 'sku ' => '7890-ijkl ' ,
732- 'pid ' => 9999 ,
733- 'lid ' => 7777 ,
734- 'quantity ' => 2 ,
735- 'unit_price ' => 5.00 ,
736- ],
737- ],
738- );
739- }
740-
741- /**
742- * Test that create_purchase() throws a ClientException when no products
743- * are specified, as this is only supported using OAuth.
744- *
745- * @since 2.2.0
746- *
747- * @return void
748- */
749- public function testCreatePurchaseWithNoProducts ()
750- {
751- $ this ->expectException (ClientException::class);
752- $ this ->api ->create_purchase (
753- email_address: $ this ->generateEmailAddress (),
754- transaction_id: str_shuffle ('wfervdrtgsdewrafvwefds ' ),
755- currency: 'usd ' ,
756- products: [],
757- );
758- }
759401}
0 commit comments