Skip to content

Commit 0d49cab

Browse files
committed
Test fixes, docs.
1 parent 9789172 commit 0d49cab

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

tests/phpunit/tests/collaboration/wpCollaborationTableStorage.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ public function test_awareness_getter_is_of_correct_shape() {
233233
* Data integrity tests.
234234
*/
235235

236+
/**
237+
* Ensure malformed updates are ignored.
238+
*
239+
* @ticket 64696
240+
*/
236241
public function test_get_updates_after_cursor_drops_malformed_json() {
237242
global $wpdb;
238243

@@ -279,6 +284,11 @@ public function test_get_updates_after_cursor_drops_malformed_json() {
279284
$this->assertSame( $valid_update_2, $updates[1] );
280285
}
281286

287+
/**
288+
* Ensure awareness getter returns the latest row when duplicate rows exist.
289+
*
290+
* @ticket 64696
291+
*/
282292
public function test_duplicate_awareness_rows_coalesces_on_latest_row() {
283293
if ( ! wp_using_ext_object_cache() ) {
284294
$this->markTestSkipped( 'This test requires that an external object cache is not in use.' );
@@ -291,7 +301,7 @@ public function test_duplicate_awareness_rows_coalesces_on_latest_row() {
291301

292302
// Simulate a race: insert two awareness rows directly.
293303
$wpdb->insert(
294-
$wpdb->postmeta,
304+
$wpdb->collaboration,
295305
array(
296306
'room' => $room,
297307
'type' => 'awareness',
@@ -303,7 +313,7 @@ public function test_duplicate_awareness_rows_coalesces_on_latest_row() {
303313
);
304314

305315
$wpdb->insert(
306-
$wpdb->postmeta,
316+
$wpdb->collaboration,
307317
array(
308318
'room' => $room,
309319
'type' => 'awareness',
@@ -315,6 +325,7 @@ public function test_duplicate_awareness_rows_coalesces_on_latest_row() {
315325
);
316326

317327
// get_awareness_state and set_awareness_state should target the latest row.
328+
wp_cache_flush();
318329
$awareness = $storage->get_awareness_state( $room );
319330
$this->assertSame( array( 'name' => 'Latest' ), $awareness[0] );
320331
$storage->set_awareness_state( $room, '1', array( 'name' => 'Current' ), 1 );

0 commit comments

Comments
 (0)