-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8cabaa
commit 6a9a4dc
Showing
7 changed files
with
137 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/** | ||
* Tests for Manufacturers API. | ||
* | ||
* @package Germanized\Tests\API | ||
* @since 3.9.0 | ||
*/ | ||
|
||
class WC_GZD_Manufacturers_API extends WC_GZD_REST_Unit_Test_Case { | ||
|
||
/** | ||
* Setup our test server, endpoints, and user info. | ||
*/ | ||
public function setUp() : void { | ||
parent::setUp(); | ||
$this->endpoint = new WC_GZD_REST_Product_Manufacturers_Controller(); | ||
$this->user = $this->factory->user->create( array( | ||
'role' => 'administrator', | ||
) ); | ||
} | ||
|
||
/** | ||
* Test creating a deposit type. | ||
* | ||
* @since 3.9.0 | ||
*/ | ||
public function test_get_deposit_type() { | ||
wp_set_current_user( $this->user ); | ||
|
||
$term = wp_insert_term( 'vendidero', 'product_manufacturer' ); | ||
|
||
if ( ! is_wp_error( $term ) ) { | ||
update_term_meta( $term['term_id'], 'formatted_address', "vendidero Gmbh\nMusterstr. 36\n12207 Berlin" ); | ||
update_term_meta( $term['term_id'], 'formatted_eu_address', "vendidero Gmbh\nMusterstr. 36\n12207 Berlin" ); | ||
} | ||
|
||
$request = new WP_REST_Request( 'GET', '/wc/v3/products/manufacturers/' . $term['term_id'] ); | ||
$response = $this->server->dispatch( $request ); | ||
|
||
$manufacturer = $response->get_data(); | ||
|
||
$this->assertEquals( 200, $response->get_status() ); | ||
|
||
$this->assertEquals( $manufacturer, array( | ||
'id' => $term['term_id'], | ||
'name' => 'vendidero', | ||
'slug' => 'vendidero', | ||
'description' => '', | ||
'count' => 0, | ||
'formatted_address' => "vendidero Gmbh\nMusterstr. 36\n12207 Berlin", | ||
'formatted_eu_address' => "vendidero Gmbh\nMusterstr. 36\n12207 Berlin", | ||
) ); | ||
|
||
wp_delete_term( $term['term_id'], 'product_manufacturer' ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters