Skip to content

Commit 89c23bb

Browse files
authored
Merge pull request #116 from Kit/remove-unnecessary-tests
Skip Redundant Tests
2 parents 8817aee + 2d202a9 commit 89c23bb

File tree

1 file changed

+36
-202
lines changed

1 file changed

+36
-202
lines changed

tests/ConvertKitAPIKeyTest.php

Lines changed: 36 additions & 202 deletions
Original file line numberDiff line numberDiff line change
@@ -357,164 +357,55 @@ public function testAddSubscribersToForms()
357357
}
358358

359359
/**
360-
* Test that add_subscribers_to_forms() returns a ClientException
361-
* when a referrer URL is specified, as this is only supported
362-
* using OAuth.
360+
* Skip this test from ConvertKitAPITest, as testAddSubscribersToForms() above
361+
* confirms a ClientException is thrown.
363362
*
364363
* @since 2.2.0
365364
*
366365
* @return void
367366
*/
368367
public function testAddSubscribersToFormsWithReferrer()
369368
{
370-
// Create subscriber.
371-
$emailAddress = $this->generateEmailAddress();
372-
$subscriber = $this->api->create_subscriber(
373-
email_address: $emailAddress
374-
);
375-
376-
// Set subscriber_id to ensure subscriber is unsubscribed after test.
377-
$this->subscriber_ids[] = $subscriber->subscriber->id;
378-
379-
$this->expectException(ClientException::class);
380-
381-
// Add subscribers to forms.
382-
$result = $this->api->add_subscribers_to_forms(
383-
forms_subscribers_ids: [
384-
[
385-
'form_id' => (int) $_ENV['CONVERTKIT_API_FORM_ID'],
386-
'subscriber_id' => $subscriber->subscriber->id,
387-
'referrer' => 'https://mywebsite.com/bfpromo/',
388-
],
389-
[
390-
'form_id' => (int) $_ENV['CONVERTKIT_API_FORM_ID_2'],
391-
'subscriber_id' => $subscriber->subscriber->id,
392-
'referrer' => 'https://mywebsite.com/bfpromo/',
393-
],
394-
]
395-
);
369+
$this->markTestSkipped('testAddSubscribersToForms() above confirms a ClientException is thrown.');
396370
}
397371

398372
/**
399-
* Test that add_subscribers_to_forms() returns a ClientException
400-
* when a referrer URL with UTM parameters is specified, as this is only
401-
* supported using OAuth.
373+
* Skip this test from ConvertKitAPITest, as testAddSubscribersToForms() above
374+
* confirms a ClientException is thrown.
402375
*
403376
* @since 2.2.0
404377
*
405378
* @return void
406379
*/
407380
public function testAddSubscribersToFormsWithReferrerUTMParams()
408381
{
409-
// Define referrer.
410-
$referrerUTMParams = [
411-
'utm_source' => 'facebook',
412-
'utm_medium' => 'cpc',
413-
'utm_campaign' => 'black_friday',
414-
'utm_term' => 'car_owners',
415-
'utm_content' => 'get_10_off',
416-
];
417-
$referrer = 'https://mywebsite.com/bfpromo/?' . http_build_query($referrerUTMParams);
418-
419-
// Create subscriber.
420-
$emailAddress = $this->generateEmailAddress();
421-
$subscriber = $this->api->create_subscriber(
422-
email_address: $emailAddress
423-
);
424-
425-
// Set subscriber_id to ensure subscriber is unsubscribed after test.
426-
$this->subscriber_ids[] = $subscriber->subscriber->id;
427-
428-
$this->expectException(ClientException::class);
429-
430-
// Add subscribers to forms.
431-
$result = $this->api->add_subscribers_to_forms(
432-
forms_subscribers_ids: [
433-
[
434-
'form_id' => (int) $_ENV['CONVERTKIT_API_FORM_ID'],
435-
'subscriber_id' => $subscriber->subscriber->id,
436-
'referrer' => $referrer,
437-
],
438-
[
439-
'form_id' => (int) $_ENV['CONVERTKIT_API_FORM_ID_2'],
440-
'subscriber_id' => $subscriber->subscriber->id,
441-
'referrer' => $referrer,
442-
],
443-
]
444-
);
382+
$this->markTestSkipped('testAddSubscribersToForms() above confirms a ClientException is thrown.');
445383
}
446384

447385
/**
448-
* Test that add_subscribers_to_forms() returns a ClientException
449-
* when invalid Form IDs are specified, as this is only supported
450-
* using OAuth.
386+
* Skip this test from ConvertKitAPITest, as testAddSubscribersToForms() above
387+
* confirms a ClientException is thrown.
451388
*
452389
* @since 2.2.0
453390
*
454391
* @return void
455392
*/
456393
public function testAddSubscribersToFormsWithInvalidFormIDs()
457394
{
458-
// Create subscriber.
459-
$emailAddress = $this->generateEmailAddress();
460-
$subscriber = $this->api->create_subscriber(
461-
email_address: $emailAddress
462-
);
463-
464-
// Set subscriber_id to ensure subscriber is unsubscribed after test.
465-
$this->subscriber_ids[] = $subscriber->subscriber->id;
466-
467-
$this->expectException(ClientException::class);
468-
469-
// Add subscribers to forms.
470-
$result = $this->api->add_subscribers_to_forms(
471-
forms_subscribers_ids: [
472-
[
473-
'form_id' => 9999999,
474-
'subscriber_id' => $subscriber->subscriber->id,
475-
],
476-
[
477-
'form_id' => 9999999,
478-
'subscriber_id' => $subscriber->subscriber->id,
479-
],
480-
]
481-
);
395+
$this->markTestSkipped('testAddSubscribersToForms() above confirms a ClientException is thrown.');
482396
}
483397

484398
/**
485-
* Test that add_subscribers_to_forms() returns a ClientException
486-
* when invalid Subscriber IDs are specified, as this is only supported
399+
* Skip this test from ConvertKitAPITest, as testAddSubscribersToForms() above
400+
* confirms a ClientException is thrown.
487401
*
488402
* @since 2.2.0
489403
*
490404
* @return void
491405
*/
492406
public function testAddSubscribersToFormsWithInvalidSubscriberIDs()
493407
{
494-
// Create subscriber.
495-
$emailAddress = $this->generateEmailAddress();
496-
$subscriber = $this->api->create_subscriber(
497-
email_address: $emailAddress
498-
);
499-
500-
// Set subscriber_id to ensure subscriber is unsubscribed after test.
501-
$this->subscriber_ids[] = $subscriber->subscriber->id;
502-
503-
$this->expectException(ClientException::class);
504-
505-
// Add subscribers to forms.
506-
$result = $this->api->add_subscribers_to_forms(
507-
forms_subscribers_ids: [
508-
[
509-
'form_id' => (int) $_ENV['CONVERTKIT_API_FORM_ID'],
510-
'subscriber_id' => 999999,
511-
],
512-
[
513-
'form_id' => (int) $_ENV['CONVERTKIT_API_FORM_ID_2'],
514-
'subscriber_id' => 999999,
515-
],
516-
]
517-
);
408+
$this->markTestSkipped('testAddSubscribersToForms() above confirms a ClientException is thrown.');
518409
}
519410

520411
/**
@@ -541,40 +432,29 @@ public function testCreateSubscribers()
541432
}
542433

543434
/**
544-
* Test that create_subscribers() throws a ClientException when no data is specified.
435+
* Skip this test from ConvertKitAPITest, as testCreateSubscribersWithBlankData() above
436+
* confirms a ClientException is thrown.
545437
*
546438
* @since 2.2.0
547439
*
548440
* @return void
549441
*/
550442
public function testCreateSubscribersWithBlankData()
551443
{
552-
$this->expectException(ClientException::class);
553-
$result = $this->api->create_subscribers([
554-
[],
555-
]);
444+
$this->markTestSkipped('testCreateSubscribers() above confirms a ClientException is thrown.');
556445
}
557446

558447
/**
559-
* Test that create_subscribers() throws a ClientException when invalid email addresses
560-
* are specified, as this is only supported using OAuth.
448+
* Skip this test from ConvertKitAPITest, as testCreateSubscribersWithBlankData() above
449+
* confirms a ClientException is thrown.
561450
*
562451
* @since 2.2.0
563452
*
564453
* @return void
565454
*/
566455
public function testCreateSubscribersWithInvalidEmailAddresses()
567456
{
568-
$this->expectException(ClientException::class);
569-
$subscribers = [
570-
[
571-
'email_address' => 'not-an-email-address',
572-
],
573-
[
574-
'email_address' => 'not-an-email-address-again',
575-
],
576-
];
577-
$result = $this->api->create_subscribers($subscribers);
457+
$this->markTestSkipped('testCreateSubscribers() above confirms a ClientException is thrown.');
578458
}
579459

580460
/**
@@ -610,37 +490,29 @@ public function testGetPurchases()
610490
}
611491

612492
/**
613-
* Test that get_purchases() throws a ClientException
614-
* when the total count is included, as this is only
615-
* supported using OAuth.
493+
* Skip this test from ConvertKitAPITest, as testGetPurchases() above
494+
* confirms a ClientException is thrown.
616495
*
617496
* @since 2.2.0
618497
*
619498
* @return void
620499
*/
621500
public function testGetPurchasesWithTotalCount()
622501
{
623-
$this->expectException(ClientException::class);
624-
$result = $this->api->get_purchases(
625-
include_total_count: true
626-
);
502+
$this->markTestSkipped('testGetPurchases() above confirms a ClientException is thrown.');
627503
}
628504

629505
/**
630-
* Test that get_purchases() throws a ClientException
631-
* when pagination parameters and per_page limits are specified,
632-
* as this is only supported using OAuth.
506+
* Skip this test from ConvertKitAPITest, as testGetPurchases() above
507+
* confirms a ClientException is thrown.
633508
*
634509
* @since 2.2.0
635510
*
636511
* @return void
637512
*/
638513
public function testGetPurchasesPagination()
639514
{
640-
$this->expectException(ClientException::class);
641-
$result = $this->api->get_purchases(
642-
per_page: 1
643-
);
515+
$this->markTestSkipped('testGetPurchases() above confirms a ClientException is thrown.');
644516
}
645517

646518
/**
@@ -659,18 +531,16 @@ public function testGetPurchase()
659531
}
660532

661533
/**
662-
* Test that get_purchases() throws a ClientException when an invalid
663-
* purchase ID is specified, as this is only supported
664-
* using OAuth.
534+
* Skip this test from ConvertKitAPITest, as testGetPurchase() above
535+
* confirms a ClientException is thrown.
665536
*
666537
* @since 2.2.0
667538
*
668539
* @return void
669540
*/
670541
public function testGetPurchaseWithInvalidID()
671542
{
672-
$this->expectException(ClientException::class);
673-
$this->api->get_purchase(12345);
543+
$this->markTestSkipped('testGetPurchase() above confirms a ClientException is thrown.');
674544
}
675545

676546
/**
@@ -720,77 +590,41 @@ public function testCreatePurchase()
720590
}
721591

722592
/**
723-
* Test that create_purchase() throws a ClientException when an invalid
724-
* email address is specified, as this is only supported using OAuth.
593+
* Skip this test from ConvertKitAPITest, as testCreatePurchase() above
594+
* confirms a ClientException is thrown.
725595
*
726596
* @since 2.2.0
727597
*
728598
* @return void
729599
*/
730600
public function testCreatePurchaseWithInvalidEmailAddress()
731601
{
732-
$this->expectException(ClientException::class);
733-
$this->api->create_purchase(
734-
email_address: 'not-an-email-address',
735-
transaction_id: str_shuffle('wfervdrtgsdewrafvwefds'),
736-
currency: 'usd',
737-
products: [
738-
[
739-
'name' => 'Floppy Disk (512k)',
740-
'sku' => '7890-ijkl',
741-
'pid' => 9999,
742-
'lid' => 7777,
743-
'quantity' => 2,
744-
'unit_price' => 5.00,
745-
],
746-
],
747-
);
602+
$this->markTestSkipped('testCreatePurchase() above confirms a ClientException is thrown.');
748603
}
749604

750605
/**
751-
* Test that create_purchase() throws a ClientException when a blank
752-
* transaction ID is specified, as this is only supported using OAuth.
606+
* Skip this test from ConvertKitAPITest, as testCreatePurchase() above
607+
* confirms a ClientException is thrown.
753608
*
754609
* @since 2.2.0
755610
*
756611
* @return void
757612
*/
758613
public function testCreatePurchaseWithBlankTransactionID()
759614
{
760-
$this->expectException(ClientException::class);
761-
$this->api->create_purchase(
762-
email_address: $this->generateEmailAddress(),
763-
transaction_id: '',
764-
currency: 'usd',
765-
products: [
766-
[
767-
'name' => 'Floppy Disk (512k)',
768-
'sku' => '7890-ijkl',
769-
'pid' => 9999,
770-
'lid' => 7777,
771-
'quantity' => 2,
772-
'unit_price' => 5.00,
773-
],
774-
],
775-
);
615+
$this->markTestSkipped('testCreatePurchase() above confirms a ClientException is thrown.');
776616
}
777617

778618
/**
779-
* Test that create_purchase() throws a ClientException when no products
780-
* are specified, as this is only supported using OAuth.
619+
* Skip this test from ConvertKitAPITest, as testCreatePurchase() above
620+
* confirms a ClientException is thrown.
781621
*
782622
* @since 2.2.0
783623
*
784624
* @return void
785625
*/
786626
public function testCreatePurchaseWithNoProducts()
787627
{
788-
$this->expectException(ClientException::class);
789-
$this->api->create_purchase(
790-
email_address: $this->generateEmailAddress(),
791-
transaction_id: str_shuffle('wfervdrtgsdewrafvwefds'),
792-
currency: 'usd',
793-
products: [],
794-
);
628+
$this->markTestSkipped('testCreatePurchase() above confirms a ClientException is thrown.');
795629
}
796630
}

0 commit comments

Comments
 (0)