Update batch test function names and constants
This commit is contained in:
parent
591c66995d
commit
63c59a1f72
|
@ -72,13 +72,13 @@ class WC_Tests_API_Init extends WC_REST_Unit_Test_Case {
|
|||
add_filter( 'query', array( $this, 'filter_order_query' ) );
|
||||
|
||||
// Initiate sync.
|
||||
WC_Admin_Reports_Sync::orders_lookup_process_order( $order->get_id() );
|
||||
WC_Admin_Reports_Sync::orders_lookup_import_order( $order->get_id() );
|
||||
|
||||
// Verify that a retry job was scheduled.
|
||||
$this->assertCount( 1, $this->queue->actions );
|
||||
$this->assertArraySubset(
|
||||
array(
|
||||
'hook' => WC_Admin_Reports_Sync::SINGLE_ORDER_ACTION,
|
||||
'hook' => WC_Admin_Reports_Sync::SINGLE_ORDER_IMPORT_ACTION,
|
||||
'args' => array( $order->get_id() ),
|
||||
),
|
||||
$this->queue->actions[0]
|
||||
|
|
|
@ -45,7 +45,7 @@ class WC_Tests_Reports_Regenerate_Batching extends WC_REST_Unit_Test_Case {
|
|||
switch ( $action ) {
|
||||
case WC_Admin_Reports_Sync::QUEUE_BATCH_ACTION:
|
||||
return $this->queue_batch_size;
|
||||
case WC_Admin_Reports_Sync::CUSTOMERS_BATCH_ACTION:
|
||||
case WC_Admin_Reports_Sync::CUSTOMERS_IMPORT_BATCH_ACTION:
|
||||
return $this->customers_batch_size;
|
||||
case WC_Admin_Reports_Sync::ORDERS_BATCH_ACTION:
|
||||
return $this->orders_batch_size;
|
||||
|
@ -81,20 +81,20 @@ class WC_Tests_Reports_Regenerate_Batching extends WC_REST_Unit_Test_Case {
|
|||
$num_customers = 1234; // 1234 / 5 = 247 batches
|
||||
$num_batches = ceil( $num_customers / $this->customers_batch_size );
|
||||
|
||||
WC_Admin_Reports_Sync::queue_batches( 1, $num_batches, WC_Admin_Reports_Sync::CUSTOMERS_BATCH_ACTION );
|
||||
WC_Admin_Reports_Sync::queue_batches( 1, $num_batches, WC_Admin_Reports_Sync::CUSTOMERS_IMPORT_BATCH_ACTION );
|
||||
|
||||
$this->assertCount( $this->queue_batch_size, $this->queue->actions );
|
||||
$this->assertArraySubset(
|
||||
array(
|
||||
'hook' => WC_Admin_Reports_Sync::QUEUE_BATCH_ACTION,
|
||||
'args' => array( 1, 25, WC_Admin_Reports_Sync::CUSTOMERS_BATCH_ACTION ),
|
||||
'args' => array( 1, 25, WC_Admin_Reports_Sync::CUSTOMERS_IMPORT_BATCH_ACTION ),
|
||||
),
|
||||
$this->queue->actions[0]
|
||||
);
|
||||
$this->assertArraySubset(
|
||||
array(
|
||||
'hook' => WC_Admin_Reports_Sync::QUEUE_BATCH_ACTION,
|
||||
'args' => array( 226, 247, WC_Admin_Reports_Sync::CUSTOMERS_BATCH_ACTION ),
|
||||
'args' => array( 226, 247, WC_Admin_Reports_Sync::CUSTOMERS_IMPORT_BATCH_ACTION ),
|
||||
),
|
||||
$this->queue->actions[ $this->queue_batch_size - 1 ]
|
||||
);
|
||||
|
@ -107,19 +107,19 @@ class WC_Tests_Reports_Regenerate_Batching extends WC_REST_Unit_Test_Case {
|
|||
$num_customers = 45; // 45 / 5 = 9 batches (which is less than the batch queue size)
|
||||
$num_batches = ceil( $num_customers / $this->customers_batch_size );
|
||||
|
||||
WC_Admin_Reports_Sync::queue_batches( 1, $num_batches, WC_Admin_Reports_Sync::CUSTOMERS_BATCH_ACTION );
|
||||
WC_Admin_Reports_Sync::queue_batches( 1, $num_batches, WC_Admin_Reports_Sync::CUSTOMERS_IMPORT_BATCH_ACTION );
|
||||
|
||||
$this->assertCount( 9, $this->queue->actions );
|
||||
$this->assertArraySubset(
|
||||
array(
|
||||
'hook' => WC_Admin_Reports_Sync::CUSTOMERS_BATCH_ACTION,
|
||||
'hook' => WC_Admin_Reports_Sync::CUSTOMERS_IMPORT_BATCH_ACTION,
|
||||
'args' => array( 1 ),
|
||||
),
|
||||
$this->queue->actions[0]
|
||||
);
|
||||
$this->assertArraySubset(
|
||||
array(
|
||||
'hook' => WC_Admin_Reports_Sync::CUSTOMERS_BATCH_ACTION,
|
||||
'hook' => WC_Admin_Reports_Sync::CUSTOMERS_IMPORT_BATCH_ACTION,
|
||||
'args' => array( 9 ),
|
||||
),
|
||||
$this->queue->actions[8]
|
||||
|
|
|
@ -37,13 +37,13 @@ class WC_Tests_Reports_Queue_Prioritization extends WC_REST_Unit_Test_Case {
|
|||
* Test that we're setting a priority on our actions.
|
||||
*/
|
||||
public function test_queue_action_sets_priority() {
|
||||
WC_Admin_Reports_Sync::queue()->schedule_single( time(), WC_Admin_Reports_Sync::SINGLE_ORDER_ACTION );
|
||||
WC_Admin_Reports_Sync::queue()->schedule_single( time(), WC_Admin_Reports_Sync::SINGLE_ORDER_IMPORT_ACTION );
|
||||
|
||||
$actions = WC_Admin_Reports_Sync::queue()->search(
|
||||
array(
|
||||
'status' => 'pending',
|
||||
'claimed' => false,
|
||||
'hook' => WC_Admin_Reports_Sync::SINGLE_ORDER_ACTION,
|
||||
'hook' => WC_Admin_Reports_Sync::SINGLE_ORDER_IMPORT_ACTION,
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -55,7 +55,7 @@ class WC_Tests_Reports_Queue_Prioritization extends WC_REST_Unit_Test_Case {
|
|||
|
||||
$this->assertEquals( WC_Admin_ActionScheduler_wpPostStore::JOB_PRIORITY, $action->menu_order );
|
||||
|
||||
WC_Admin_Reports_Sync::queue()->cancel_all( WC_Admin_Reports_Sync::SINGLE_ORDER_ACTION );
|
||||
WC_Admin_Reports_Sync::queue()->cancel_all( WC_Admin_Reports_Sync::SINGLE_ORDER_IMPORT_ACTION );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue