Skip to content

Commit 7494bda

Browse files
committed
Flush cache
1 parent aae4c26 commit 7494bda

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

tests/php/features/WooCommerce/TestWooCommerceOrders.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,15 @@ public function testSearchShopOrderByMetaFieldAndId() {
217217

218218
$this->assertTrue( class_exists( '\WC_Order' ) );
219219

220+
221+
wp_cache_flush();
220222
$shop_order_1 = new \WC_Order();
221223
$shop_order_1->save();
222224
$shop_order_id_1 = $shop_order_1->get_id();
223225
ElasticPress\Indexables::factory()->get( 'post' )->index( $shop_order_id_1, true );
224226

227+
228+
wp_cache_flush();
225229
$shop_order_2 = new \WC_Order();
226230
$shop_order_2->set_billing_phone( 'Phone number that matches an order ID: ' . $shop_order_id_1 );
227231
$shop_order_2->save();
@@ -418,6 +422,8 @@ public function test_hpos_data_is_indexed() {
418422
ElasticPress\Features::factory()->activate_feature( 'protected_content' );
419423
ElasticPress\Features::factory()->setup_features();
420424

425+
426+
wp_cache_flush();
421427
$shop_order_1 = new \WC_Order();
422428
$shop_order_1->save();
423429
$shop_order_id_1 = $shop_order_1->get_id();
@@ -468,6 +474,8 @@ public function test_hpos_order_search() {
468474
ElasticPress\Features::factory()->activate_feature( 'protected_content' );
469475
ElasticPress\Features::factory()->setup_features();
470476

477+
478+
wp_cache_flush();
471479
$shop_order_1 = new \WC_Order();
472480
$shop_order_1->save();
473481
$shop_order_id_1 = $shop_order_1->get_id();
@@ -497,6 +505,8 @@ public function test_hpos_search_with_post_type() {
497505
ElasticPress\Features::factory()->activate_feature( 'protected_content' );
498506
ElasticPress\Features::factory()->setup_features();
499507

508+
509+
wp_cache_flush();
500510
$shop_order_1 = new \WC_Order();
501511
$shop_order_1->save();
502512
$shop_order_id_1 = $shop_order_1->get_id();
@@ -543,30 +553,40 @@ public function test_hpos_filter_by_status() {
543553
ElasticPress\Features::factory()->activate_feature( 'protected_content' );
544554
ElasticPress\Features::factory()->setup_features();
545555

556+
557+
wp_cache_flush();
546558
$shop_order_1 = new \WC_Order();
547559
$shop_order_1->set_status( OrderStatus::COMPLETED );
548560
$shop_order_1->save();
549561
$shop_order_id_1 = $shop_order_1->get_id();
550562
ElasticPress\Indexables::factory()->get( 'post' )->index( $shop_order_id_1, true );
551563

564+
565+
wp_cache_flush();
552566
$shop_order_2 = new \WC_Order();
553567
$shop_order_2->set_status( OrderStatus::PENDING );
554568
$shop_order_2->save();
555569
$shop_order_id_2 = $shop_order_2->get_id();
556570
ElasticPress\Indexables::factory()->get( 'post' )->index( $shop_order_id_2, true );
557571

572+
573+
wp_cache_flush();
558574
$shop_order_3 = new \WC_Order();
559575
$shop_order_3->set_status( OrderStatus::ON_HOLD );
560576
$shop_order_3->save();
561577
$shop_order_id_3 = $shop_order_3->get_id();
562578
ElasticPress\Indexables::factory()->get( 'post' )->index( $shop_order_id_3, true );
563579

580+
581+
wp_cache_flush();
564582
$shop_order_4 = new \WC_Order();
565583
$shop_order_4->set_status( OrderStatus::PROCESSING );
566584
$shop_order_4->save();
567585
$shop_order_id_4 = $shop_order_4->get_id();
568586
ElasticPress\Indexables::factory()->get( 'post' )->index( $shop_order_id_4, true );
569587

588+
589+
wp_cache_flush();
570590
$shop_order_5 = new \WC_Order();
571591
$shop_order_5->set_status( OrderStatus::CHECKOUT_DRAFT );
572592
$shop_order_5->save();
@@ -626,11 +646,15 @@ public function test_hpos_order_limit() {
626646
ElasticPress\Features::factory()->activate_feature( 'protected_content' );
627647
ElasticPress\Features::factory()->setup_features();
628648

649+
650+
wp_cache_flush();
629651
$shop_order_1 = new \WC_Order();
630652
$shop_order_1->save();
631653
$shop_order_id_1 = $shop_order_1->get_id();
632654
ElasticPress\Indexables::factory()->get( 'post' )->index( $shop_order_id_1, true );
633655

656+
657+
wp_cache_flush();
634658
$shop_order_2 = new \WC_Order();
635659
$shop_order_2->save();
636660
$shop_order_id_2 = $shop_order_2->get_id();
@@ -662,16 +686,22 @@ public function test_hpos_paged() {
662686
ElasticPress\Features::factory()->activate_feature( 'protected_content' );
663687
ElasticPress\Features::factory()->setup_features();
664688

689+
690+
wp_cache_flush();
665691
$shop_order_1 = new \WC_Order();
666692
$shop_order_1->save();
667693
$shop_order_id_1 = $shop_order_1->get_id();
668694
ElasticPress\Indexables::factory()->get( 'post' )->index( $shop_order_id_1, true );
669695

696+
697+
wp_cache_flush();
670698
$shop_order_2 = new \WC_Order();
671699
$shop_order_2->save();
672700
$shop_order_id_2 = $shop_order_2->get_id();
673701
ElasticPress\Indexables::factory()->get( 'post' )->index( $shop_order_id_2, true );
674702

703+
704+
wp_cache_flush();
675705
$shop_order_3 = new \WC_Order();
676706
$shop_order_3->save();
677707
$shop_order_id_3 = $shop_order_3->get_id();
@@ -717,12 +747,16 @@ public function test_hpos_order_by_date() {
717747
ElasticPress\Features::factory()->activate_feature( 'protected_content' );
718748
ElasticPress\Features::factory()->setup_features();
719749

750+
751+
wp_cache_flush();
720752
$shop_order_1 = new \WC_Order();
721753
$shop_order_1->set_date_created( new \WC_DateTime( '2026-01-01 12:00:00' ) );
722754
$shop_order_1->save();
723755
$shop_order_id_1 = $shop_order_1->get_id();
724756
ElasticPress\Indexables::factory()->get( 'post' )->index( $shop_order_id_1, true );
725757

758+
759+
wp_cache_flush();
726760
$shop_order_2 = new \WC_Order();
727761
$shop_order_2->set_date_created( new \WC_DateTime( '2026-01-02 12:00:00' ) );
728762
$shop_order_2->save();
@@ -756,12 +790,16 @@ public function test_hpos_order_by_date_asc() {
756790
ElasticPress\Features::factory()->activate_feature( 'protected_content' );
757791
ElasticPress\Features::factory()->setup_features();
758792

793+
794+
wp_cache_flush();
759795
$shop_order_1 = new \WC_Order();
760796
$shop_order_1->set_date_created( new \WC_DateTime( '2026-01-01 12:00:00' ) );
761797
$shop_order_1->save();
762798
$shop_order_id_1 = $shop_order_1->get_id();
763799
ElasticPress\Indexables::factory()->get( 'post' )->index( $shop_order_id_1, true );
764800

801+
802+
wp_cache_flush();
765803
$shop_order_2 = new \WC_Order();
766804
$shop_order_2->set_date_created( new \WC_DateTime( '2026-01-02 12:00:00' ) );
767805
$shop_order_2->save();

0 commit comments

Comments
 (0)