@@ -746,6 +746,49 @@ public function testGetForms()
746
746
747
747
// Assert form is not a landing page i.e embed.
748
748
$ this ->assertEquals ($ form ['type ' ], 'embed ' );
749
+
750
+ // Assert form is not archived.
751
+ $ this ->assertFalse ($ form ['archived ' ]);
752
+ }
753
+ }
754
+
755
+ /**
756
+ * Test that get_forms() returns the expected data when
757
+ * the status is set to archived.
758
+ *
759
+ * @since 2.0.0
760
+ *
761
+ * @return void
762
+ */
763
+ public function testGetFormsWithArchivedStatus ()
764
+ {
765
+ $ result = $ this ->api ->get_forms (
766
+ status: 'archived '
767
+ );
768
+
769
+ // Assert forms and pagination exist.
770
+ $ this ->assertDataExists ($ result , 'forms ' );
771
+ $ this ->assertPaginationExists ($ result );
772
+
773
+ // Iterate through each form, confirming no landing pages were included.
774
+ foreach ($ result ->forms as $ form ) {
775
+ $ form = get_object_vars ($ form );
776
+
777
+ // Assert shape of object is valid.
778
+ $ this ->assertArrayHasKey ('id ' , $ form );
779
+ $ this ->assertArrayHasKey ('name ' , $ form );
780
+ $ this ->assertArrayHasKey ('created_at ' , $ form );
781
+ $ this ->assertArrayHasKey ('type ' , $ form );
782
+ $ this ->assertArrayHasKey ('format ' , $ form );
783
+ $ this ->assertArrayHasKey ('embed_js ' , $ form );
784
+ $ this ->assertArrayHasKey ('embed_url ' , $ form );
785
+ $ this ->assertArrayHasKey ('archived ' , $ form );
786
+
787
+ // Assert form is not a landing page i.e embed.
788
+ $ this ->assertEquals ($ form ['type ' ], 'embed ' );
789
+
790
+ // Assert form is not archived.
791
+ $ this ->assertTrue ($ form ['archived ' ]);
749
792
}
750
793
}
751
794
@@ -863,9 +906,34 @@ public function testGetLandingPages()
863
906
864
907
// Assert form is a landing page i.e. hosted.
865
908
$ this ->assertEquals ($ form ['type ' ], 'hosted ' );
909
+
910
+ // Assert form is not archived.
911
+ $ this ->assertFalse ($ form ['archived ' ]);
866
912
}
867
913
}
868
914
915
+ /**
916
+ * Test that get_landing_pages() returns the expected data when
917
+ * the status is set to archived.
918
+ *
919
+ * @since 2.0.0
920
+ *
921
+ * @return void
922
+ */
923
+ public function testGetLandingPagesWithArchivedStatus ()
924
+ {
925
+ $ result = $ this ->api ->get_forms (
926
+ status: 'archived '
927
+ );
928
+
929
+ // Assert forms and pagination exist.
930
+ $ this ->assertDataExists ($ result , 'forms ' );
931
+ $ this ->assertPaginationExists ($ result );
932
+
933
+ // Assert no landing pages are returned, as the account doesn't have any archived landing pages.
934
+ $ this ->assertCount (0 , $ result ->forms );
935
+ }
936
+
869
937
/**
870
938
* Test that get_landing_pages() returns the expected data
871
939
* when the total count is included.
0 commit comments