@@ -97,17 +97,18 @@ public function test_search_orders_can_search_by_order_id() {
9797 }
9898
9999 public function test_search_orders_can_check_post_meta () {
100- $ product = $ this ->factory ()->product ->create ();
100+ $ order = $ this ->factory ()->order ->create ();
101+ $ term = uniqid ( 'search term ' );
101102
102- add_post_meta ( $ product , 'some_custom_meta_key ' , ' search term' );
103+ add_post_meta ( $ order , 'some_custom_meta_key ' , $ term );
103104
104105 add_filter ( 'woocommerce_shop_order_search_fields ' , function () {
105106 return array ( 'some_custom_meta_key ' );
106107 } );
107108
108109 $ this ->assertEquals (
109- array ( $ product ),
110- ( new WC_Order_Data_Store_Custom_Table () )->search_orders ( ' search ' ),
110+ array ( $ order ),
111+ ( new WC_Order_Data_Store_Custom_Table () )->search_orders ( $ term ),
111112 'If post meta keys are specified, they should also be searched. '
112113 );
113114 }
@@ -116,12 +117,13 @@ public function test_search_orders_can_check_post_meta() {
116117 * Same as test_search_orders_can_check_post_meta(), but the filter is never added.
117118 */
118119 public function test_search_orders_only_checks_post_meta_if_specified () {
119- $ product = $ this ->factory ()->product ->create ();
120+ $ order = $ this ->factory ()->order ->create ();
121+ $ term = uniqid ( 'search term ' );
120122
121- add_post_meta ( $ product , 'some_custom_meta_key ' , ' search term' );
123+ add_post_meta ( $ order , 'some_custom_meta_key ' , $ term );
122124
123125 $ this ->assertEmpty (
124- ( new WC_Order_Data_Store_Custom_Table () )->search_orders ( ' search ' ),
126+ ( new WC_Order_Data_Store_Custom_Table () )->search_orders ( $ term ),
125127 'Only search post meta if keys are provided. '
126128 );
127129 }
0 commit comments