@@ -2959,6 +2959,30 @@ public function testGetTagSubscriptions()
29592959 $ this ->assertPaginationExists ($ result );
29602960 }
29612961
2962+ /**
2963+ * Test that get_tag_subscriptions() returns the expected data
2964+ * when the slim parameter is specified.
2965+ *
2966+ * @since 2.5
2967+ *
2968+ * @return void
2969+ */
2970+ public function testGetTagSubscriptionsSlim ()
2971+ {
2972+ $ result = $ this ->api ->get_tag_subscriptions (
2973+ tag_id: (int ) $ _ENV ['CONVERTKIT_API_TAG_ID ' ],
2974+ slim: true
2975+ );
2976+
2977+ // Assert subscribers and pagination exist.
2978+ $ this ->assertDataExists ($ result , 'subscribers ' );
2979+ $ this ->assertPaginationExists ($ result );
2980+
2981+ // Confirm custom field values are excluded from the data.
2982+ $ broadcast = get_object_vars ($ result ->subscribers [0 ]);
2983+ $ this ->assertArrayNotHasKey ('fields ' , $ broadcast );
2984+ }
2985+
29622986 /**
29632987 * Test that get_tag_subscriptions() returns the expected data
29642988 * when the total count is included.
@@ -5292,6 +5316,33 @@ public function testGetBroadcastsWithSentBefore()
52925316 $ this ->assertCount (12 , $ result ->broadcasts );
52935317 }
52945318
5319+ /**
5320+ * Test that get_broadcasts() returns the expected data
5321+ * when the slim parameter is specified.
5322+ *
5323+ * @since 2.5
5324+ *
5325+ * @return void
5326+ */
5327+ public function testGetBroadcastsSlim ()
5328+ {
5329+ $ result = $ this ->api ->get_broadcasts (
5330+ slim: true
5331+ );
5332+
5333+ // Assert broadcasts and pagination exist.
5334+ $ this ->assertDataExists ($ result , 'broadcasts ' );
5335+ $ this ->assertPaginationExists ($ result );
5336+
5337+ // Confirm content, public_url, email_address, email_template and subscriber_filter are excluded from the data.
5338+ $ broadcast = get_object_vars ($ result ->broadcasts [0 ]);
5339+ $ this ->assertArrayNotHasKey ('content ' , $ broadcast );
5340+ $ this ->assertArrayNotHasKey ('public_url ' , $ broadcast );
5341+ $ this ->assertArrayNotHasKey ('email_address ' , $ broadcast );
5342+ $ this ->assertArrayNotHasKey ('email_template ' , $ broadcast );
5343+ $ this ->assertArrayNotHasKey ('subscriber_filter ' , $ broadcast );
5344+ }
5345+
52955346 /**
52965347 * Test that get_broadcasts() returns the expected data
52975348 * when pagination parameters and per_page limits are specified.
@@ -5618,6 +5669,77 @@ public function testGetBroadcastsStats()
56185669 $ this ->assertEquals ($ id , $ result ->broadcasts [0 ]->id );
56195670 }
56205671
5672+ /**
5673+ * Test that get_broadcasts_stats() returns the expected data
5674+ * when a valid sent_after date is specified.
5675+ *
5676+ * @since 2.5
5677+ *
5678+ * @return void
5679+ */
5680+ public function testGetBroadcastsStatsWithSentAfter ()
5681+ {
5682+ $ date = new DateTime ('now ' );
5683+ $ date ->modify ('-4 years ' );
5684+ $ result = $ this ->api ->get_broadcasts_stats (
5685+ sent_after: $ date ,
5686+ );
5687+
5688+ // Assert broadcasts and pagination exist.
5689+ $ this ->assertDataExists ($ result , 'broadcasts ' );
5690+ $ this ->assertPaginationExists ($ result );
5691+
5692+ // Assert the expected number of broadcasts were returned.
5693+ $ this ->assertCount (8 , $ result ->broadcasts );
5694+ }
5695+
5696+ /**
5697+ * Test that get_broadcasts_stats() returns no broadcasts
5698+ * when a sent_after date is specified that is after all broadcasts.
5699+ *
5700+ * @since 2.5
5701+ *
5702+ * @return void
5703+ */
5704+ public function testGetBroadcastsStatsWithSentAfterNow ()
5705+ {
5706+ $ date = new DateTime ('now ' );
5707+ $ date ->modify ('-1 day ' );
5708+ $ result = $ this ->api ->get_broadcasts_stats (
5709+ sent_after: $ date ,
5710+ );
5711+
5712+ // Assert broadcasts and pagination exist.
5713+ $ this ->assertDataExists ($ result , 'broadcasts ' );
5714+ $ this ->assertPaginationExists ($ result );
5715+
5716+ // Assert no broadcasts were returned.
5717+ $ this ->assertCount (0 , $ result ->broadcasts );
5718+ }
5719+
5720+ /**
5721+ * Test that get_broadcasts_stats() returns the expected data
5722+ * when a valid sent_before date is specified.
5723+ *
5724+ * @since 2.5
5725+ *
5726+ * @return void
5727+ */
5728+ public function testGetBroadcastsStatsWithSentBefore ()
5729+ {
5730+ $ date = new DateTime ('now ' );
5731+ $ result = $ this ->api ->get_broadcasts_stats (
5732+ sent_before: new DateTime ('now ' ),
5733+ );
5734+
5735+ // Assert broadcasts and pagination exist.
5736+ $ this ->assertDataExists ($ result , 'broadcasts ' );
5737+ $ this ->assertPaginationExists ($ result );
5738+
5739+ // Assert the expected number of broadcasts were returned.
5740+ $ this ->assertCount (12 , $ result ->broadcasts );
5741+ }
5742+
56215743 /**
56225744 * Test that get_broadcasts_stats() returns the expected data
56235745 * when the total count is included.
0 commit comments