@@ -24,10 +24,8 @@ public function setUp() {
2424 wp_set_current_user ( 0 );
2525
2626 $ this ->products = [];
27- $ this ->products [0 ] = ProductHelper::create_simple_product ( false );
28- $ this ->products [0 ]->save ();
29- $ this ->products [1 ] = ProductHelper::create_simple_product ( false );
30- $ this ->products [1 ]->save ();
27+ $ this ->products [0 ] = ProductHelper::create_simple_product ( true );
28+ $ this ->products [1 ] = ProductHelper::create_simple_product ( true );
3129 }
3230
3331 /**
@@ -55,6 +53,11 @@ public function test_get_item() {
5553 $ this ->assertEquals ( $ this ->products [0 ]->get_price_html (), $ data ['price_html ' ] );
5654 $ this ->assertEquals ( $ this ->products [0 ]->get_average_rating (), $ data ['average_rating ' ] );
5755 $ this ->assertEquals ( $ this ->products [0 ]->get_review_count (), $ data ['review_count ' ] );
56+ $ this ->assertEquals ( $ this ->products [0 ]->has_options (), $ data ['has_options ' ] );
57+ $ this ->assertEquals ( $ this ->products [0 ]->is_purchasable (), $ data ['is_purchasable ' ] );
58+ $ this ->assertEquals ( $ this ->products [0 ]->is_in_stock (), $ data ['is_in_stock ' ] );
59+ $ this ->assertEquals ( $ this ->products [0 ]->add_to_cart_text (), $ data ['add_to_cart ' ]['text ' ] );
60+ $ this ->assertEquals ( $ this ->products [0 ]->add_to_cart_description (), $ data ['add_to_cart ' ]['description ' ] );
5861 }
5962
6063 /**
@@ -77,6 +80,10 @@ public function test_get_items() {
7780 $ this ->assertArrayHasKey ( 'average_rating ' , $ data [0 ] );
7881 $ this ->assertArrayHasKey ( 'review_count ' , $ data [0 ] );
7982 $ this ->assertArrayHasKey ( 'images ' , $ data [0 ] );
83+ $ this ->assertArrayHasKey ( 'has_options ' , $ data [0 ] );
84+ $ this ->assertArrayHasKey ( 'is_purchasable ' , $ data [0 ] );
85+ $ this ->assertArrayHasKey ( 'is_in_stock ' , $ data [0 ] );
86+ $ this ->assertArrayHasKey ( 'add_to_cart ' , $ data [0 ] );
8087 }
8188
8289 /**
@@ -97,6 +104,10 @@ public function test_get_item_schema() {
97104 $ this ->assertArrayHasKey ( 'average_rating ' , $ schema ['properties ' ] );
98105 $ this ->assertArrayHasKey ( 'review_count ' , $ schema ['properties ' ] );
99106 $ this ->assertArrayHasKey ( 'images ' , $ schema ['properties ' ] );
107+ $ this ->assertArrayHasKey ( 'has_options ' , $ schema ['properties ' ] );
108+ $ this ->assertArrayHasKey ( 'is_purchasable ' , $ schema ['properties ' ] );
109+ $ this ->assertArrayHasKey ( 'is_in_stock ' , $ schema ['properties ' ] );
110+ $ this ->assertArrayHasKey ( 'add_to_cart ' , $ schema ['properties ' ] );
100111 }
101112
102113 /**
@@ -117,6 +128,10 @@ public function test_prepare_item_for_response() {
117128 $ this ->assertArrayHasKey ( 'average_rating ' , $ response ->get_data () );
118129 $ this ->assertArrayHasKey ( 'review_count ' , $ response ->get_data () );
119130 $ this ->assertArrayHasKey ( 'images ' , $ response ->get_data () );
131+ $ this ->assertArrayHasKey ( 'has_options ' , $ response ->get_data () );
132+ $ this ->assertArrayHasKey ( 'is_purchasable ' , $ response ->get_data () );
133+ $ this ->assertArrayHasKey ( 'is_in_stock ' , $ response ->get_data () );
134+ $ this ->assertArrayHasKey ( 'add_to_cart ' , $ response ->get_data () );
120135 }
121136
122137 /**
0 commit comments