Skip to content

Commit

Permalink
Remove named arguments for PHP 7.4 compat.
Browse files Browse the repository at this point in the history
  • Loading branch information
n7studios committed Apr 17, 2024
1 parent e0b3760 commit 7f877c9
Showing 1 changed file with 17 additions and 24 deletions.
41 changes: 17 additions & 24 deletions tests/wpunit/APITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1339,9 +1339,8 @@ public function testUnsubscribeWithInvalidEmail()
*/
public function testGetBroadcastsPagination()
{
$result = $this->api->get_broadcasts(
per_page: 1
);
// Return one broadcast.
$result = $this->api->get_broadcasts(false, '', '', 1);

// Assert broadcasts and pagination exist.
$this->assertDataExists($result, 'broadcasts');
Expand All @@ -1355,10 +1354,7 @@ public function testGetBroadcastsPagination()
$this->assertTrue($result['pagination']['has_next_page']);

// Use pagination to fetch next page.
$result = $this->api->get_broadcasts(
per_page: 1,
after_cursor: $result['pagination']['end_cursor']
);
$result = $this->api->get_broadcasts(false, $result['pagination']['end_cursor'], '', 1);

// Assert broadcasts and pagination exist.
$this->assertDataExists($result, 'broadcasts');
Expand All @@ -1372,10 +1368,7 @@ public function testGetBroadcastsPagination()
$this->assertTrue($result['pagination']['has_next_page']);

// Use pagination to fetch previous page.
$result = $this->api->get_broadcasts(
per_page: 1,
before_cursor: $result['pagination']['start_cursor']
);
$result = $this->api->get_broadcasts(false, '', $result['pagination']['start_cursor'], 1);

// Assert broadcasts and pagination exist.
$this->assertDataExists($result, 'broadcasts');
Expand Down Expand Up @@ -1405,9 +1398,9 @@ public function testCreateUpdateAndDeleteDraftBroadcast()
{
// Create a broadcast first.
$result = $this->api->create_broadcast(
subject: 'Test Subject',
content: 'Test Content',
description: 'Test Broadcast from WordPress Libraries',
'Test Subject',
'Test Content',
'Test Broadcast from WordPress Libraries',
);
$this->assertNotInstanceOf(WP_Error::class, $result);
$this->assertIsArray($result);
Expand All @@ -1426,10 +1419,10 @@ public function testCreateUpdateAndDeleteDraftBroadcast()

// Update the existing broadcast.
$result = $this->api->update_broadcast(
id: $broadcastID,
subject: 'New Test Subject',
content: 'New Test Content',
description: 'New Test Broadcast from WordPress Libraries'
$broadcastID,
'New Test Subject',
'New Test Content',
'New Test Broadcast from WordPress Libraries'
);
$this->assertNotInstanceOf(WP_Error::class, $result);
$this->assertIsArray($result);
Expand Down Expand Up @@ -1465,12 +1458,12 @@ public function testCreatePublicBroadcastWithValidDates()

// Create broadcast first.
$result = $this->api->create_broadcast(
subject: 'Test Subject',
content: 'Test Content',
description: 'Test Broadcast from WordPress Libraries',
public: true,
published_at: $publishedAt,
send_at: $sendAt
'Test Subject',
'Test Content',
'Test Broadcast from WordPress Libraries',
true,
$publishedAt,
$sendAt
);
$this->assertNotInstanceOf(WP_Error::class, $result);
$this->assertIsArray($result);
Expand Down

0 comments on commit 7f877c9

Please sign in to comment.