Skip to content

Commit

Permalink
Unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisnissle committed Sep 23, 2024
1 parent 6a9a4dc commit 2a6947d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions includes/api/class-wc-gzd-rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function register_rest_routes() {
'WC_GZD_REST_Product_Deposit_Types_Controller',
'WC_GZD_REST_Product_Units_V1_Controller',
'WC_GZD_REST_Product_Units_Controller',
'WC_GZD_REST_Product_Manufacturers_Controller',
'WC_GZD_REST_Customers_Controller',
'WC_GZD_REST_Orders_Controller',
'WC_GZD_REST_Products_Controller',
Expand Down
2 changes: 1 addition & 1 deletion tests/unit-tests/api/manufacturers.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function setUp() : void {
*
* @since 3.9.0
*/
public function test_get_deposit_type() {
public function test_get_manufacturer() {
wp_set_current_user( $this->user );

$term = wp_insert_term( 'vendidero', 'product_manufacturer' );
Expand Down
4 changes: 4 additions & 0 deletions tests/unit-tests/api/products.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ public function test_create_product() {
$nutrient_2 = wp_insert_term( 'Natrium', 'product_nutrient', array( 'slug' => 'natrium' ) );
$allergen = wp_insert_term( 'Nut', 'product_allergen', array( 'slug' => 'nut' ) );

var_dump($manufacturer);

// Create simple.
$request = new WP_REST_Request( 'POST', '/wc/v3/products' );
$request->set_body_params(
Expand Down Expand Up @@ -160,7 +162,9 @@ public function test_create_product() {
);

$response = $this->server->dispatch( $request );
var_dump($response);
$data = $response->get_data();
var_dump($data);

$this->assertEquals( 'test-sale', $data['sale_price_label']['slug'] );
$this->assertEquals( '3-4-days', $data['delivery_time']['slug'] );
Expand Down

0 comments on commit 2a6947d

Please sign in to comment.