Skip to content

Commit

Permalink
add a test for the best-effort approach to saving a unique action to …
Browse files Browse the repository at this point in the history
…a hybrid store
  • Loading branch information
lsinger committed Feb 27, 2024
1 parent 65b0d73 commit ad63d64
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/phpunit/procedural_api/procedural_api_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,20 @@ public function test_as_enqueue_async_action_unique() {
$this->assertEquals( 0, $action_id_duplicate );
}

/**
* Test enqueueing a unique action using the hybrid store.
* This is using a best-effort approach, so it's possible that the action will be enqueued even if it's not unique.
*/
public function test_as_enqueue_async_action_unique_hybrid_best_effort() {
$this->set_action_scheduler_store( new ActionScheduler_HybridStore() );

$action_id = as_enqueue_async_action( 'hook_1', array( 'a' ), 'dummy', true );
$this->assertValidAction( $action_id );

$action_id_duplicate = as_enqueue_async_action( 'hook_1', array( 'a' ), 'dummy', true );
$this->assertEquals( 0, $action_id_duplicate );
}

/**
* Test as_schedule_single_action with unique param.
*/
Expand Down

0 comments on commit ad63d64

Please sign in to comment.