Skip to content

Commit a93716a

Browse files
committed
Add testGetBroadcastsStatsWithTotalCount test
1 parent 964bced commit a93716a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/ConvertKitAPITest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4255,6 +4255,29 @@ public function testGetBroadcastsStats()
42554255
$this->assertEquals($id, $result->broadcasts[0]->id);
42564256
}
42574257

4258+
/**
4259+
* Test that get_broadcasts_stats() returns the expected data
4260+
* when the total count is included.
4261+
*
4262+
* @since 2.2.1
4263+
*
4264+
* @return void
4265+
*/
4266+
public function testGetBroadcastsStatsWithTotalCount()
4267+
{
4268+
$result = $this->api->get_broadcasts_stats(
4269+
include_total_count: true
4270+
);
4271+
4272+
// Assert broadcasts and pagination exist.
4273+
$this->assertDataExists($result, 'broadcasts');
4274+
$this->assertPaginationExists($result);
4275+
4276+
// Assert total count is included.
4277+
$this->assertArrayHasKey('total_count', get_object_vars($result->pagination));
4278+
$this->assertGreaterThan(0, $result->pagination->total_count);
4279+
}
4280+
42584281
/**
42594282
* Test that update_broadcast() throws a ClientException when an invalid
42604283
* broadcast ID is specified.

0 commit comments

Comments
 (0)