@@ -507,16 +507,85 @@ public function testCreatePurchase()
507507 }
508508
509509 /**
510- * Test that fetching a URL works.
510+ * Test that fetching a legacy form's markup works.
511511 *
512512 * @since 1.0.0
513513 *
514514 * @return void
515515 */
516- public function testGetResource ()
516+ public function testGetResourceLegacyForm ()
517+ {
518+ $ markup = $ this ->api ->get_resource ($ _ENV ['CONVERTKIT_API_LEGACY_FORM_URL ' ]);
519+
520+ // Assert that the markup is HTML.
521+ $ this ->assertTrue ($ this ->isHtml ($ markup ));
522+
523+ // Confirm that encoding works correctly.
524+ $ this ->assertStringContainsString ('Vantar þinn ungling sjálfstraust í stærðfræði? ' , $ markup );
525+ }
526+
527+ /**
528+ * Test that fetching a landing page's markup works.
529+ *
530+ * @since 1.0.0
531+ *
532+ * @return void
533+ */
534+ public function testGetResourceLandingPage ()
535+ {
536+ $ markup = $ this ->api ->get_resource ($ _ENV ['CONVERTKIT_API_LANDING_PAGE_URL ' ]);
537+
538+ // Assert that the markup is HTML.
539+ $ this ->assertTrue ($ this ->isHtml ($ markup ));
540+
541+ // Confirm that encoding works correctly.
542+ $ this ->assertStringContainsString ('Vantar þinn ungling sjálfstraust í stærðfræði? ' , $ markup );
543+ }
544+
545+ /**
546+ * Test that fetching a legacy landing page's markup works.
547+ *
548+ * @since 1.0.0
549+ *
550+ * @return void
551+ */
552+ public function testGetResourceLegacyLandingPage ()
517553 {
518554 $ markup = $ this ->api ->get_resource ($ _ENV ['CONVERTKIT_API_LEGACY_LANDING_PAGE_URL ' ]);
555+
556+ // Assert that the markup is HTML.
519557 $ this ->assertTrue ($ this ->isHtml ($ markup ));
558+
559+ // Confirm that encoding works correctly.
560+ $ this ->assertStringContainsString ('Legacy Landing Page ' , $ markup );
561+ }
562+
563+ /**
564+ * Test that get_resource() throws an InvalidArgumentException when an invalid
565+ * URL is specified.
566+ *
567+ * @since 1.0.0
568+ *
569+ * @return void
570+ */
571+ public function testGetResourceInvalidURL ()
572+ {
573+ $ this ->expectException (\InvalidArgumentException::class);
574+ $ markup = $ this ->api ->get_resource ('not-a-url ' );
575+ }
576+
577+ /**
578+ * Test that get_resource() throws a ClientException when an inaccessible
579+ * URL is specified.
580+ *
581+ * @since 1.0.0
582+ *
583+ * @return void
584+ */
585+ public function testGetResourceInaccessibleURL ()
586+ {
587+ $ this ->expectException (GuzzleHttp \Exception \ClientException::class);
588+ $ markup = $ this ->api ->get_resource ('https://convertkit.com/a/url/that/does/not/exist ' );
520589 }
521590
522591 /**
0 commit comments