Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Tests: Check the publish post action exists, but is not necessarily the last action.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,21 @@ public function test_sending_empties_queue() {
public function test_sends_publish_post_action() {
$post_id = self::factory()->post->create();
$this->sender->do_sync();
$event = $this->server_event_storage->get_most_recent_event();
$this->assertEquals( 'jetpack_published_post', $event->action );
$this->assertEquals( $post_id, $event->args[0] );
$events = $this->server_event_storage->get_all_events();

$found = null;
$target_post_id = (int) $post_id;
$events_count = count( $events );
for ( $i = $events_count - 1; $i >= 0; $i-- ) {
$event = $events[ $i ];
if ( 'jetpack_published_post' === $event->action && (int) $event->args[0] === $target_post_id ) {
$found = $event;
break;
}
}

$this->assertNotNull( $found, 'Expected jetpack_published_post for post ' . $post_id );
$this->assertEquals( $post_id, $found->args[0] );
}

public function test_schedules_incremental_sync_cron() {
Expand Down
Loading