-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2543 from woocommerce/tweak/default-tax-2491
Set default tax_rate to destination
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 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
47 changes: 47 additions & 0 deletions
47
tests/Unit/API/Site/Controllers/MerchantCenter/SettingsControllerTest.php
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,47 @@ | ||
<?php | ||
|
||
namespace Automattic\WooCommerce\GoogleListingsAndAds\Tests\Unit\API\Site\Controllers\MerchantCenter; | ||
|
||
use Automattic\WooCommerce\GoogleListingsAndAds\API\Site\Controllers\MerchantCenter\SettingsController; | ||
use Automattic\WooCommerce\GoogleListingsAndAds\Options\OptionsInterface; | ||
use Automattic\WooCommerce\GoogleListingsAndAds\Tests\Framework\RESTControllerUnitTest; | ||
|
||
/** | ||
* Class SettingsControllerTest | ||
* | ||
* @package Automattic\WooCommerce\GoogleListingsAndAds\Tests\Unit\API\Site\Controllers\MerchantCenter | ||
*/ | ||
class SettingsControllerTest extends RESTControllerUnitTest { | ||
|
||
/** @var SettingsController $controller */ | ||
protected $controller; | ||
|
||
/** @var MockObject|OptionsInterface $options */ | ||
protected $options; | ||
|
||
protected const ROUTE = '/wc/gla/mc/settings'; | ||
|
||
public function setUp(): void { | ||
parent::setUp(); | ||
|
||
$this->controller = new SettingsController( $this->server ); | ||
|
||
$this->options = $this->createMock( OptionsInterface::class ); | ||
$this->controller->set_options_object( $this->options ); | ||
$this->controller->register(); | ||
} | ||
|
||
public function test_default_tax_rate_settings() { | ||
$response = $this->do_request( self::ROUTE ); | ||
|
||
$this->assertEquals( 'destination', $response->get_data()['tax_rate'] ); | ||
$this->assertEquals( 200, $response->get_status() ); | ||
} | ||
|
||
public function test_default_tax_rate_settings_post() { | ||
$response = $this->do_request( self::ROUTE, 'POST', [] ); | ||
|
||
$this->assertEquals( 'destination', $response->get_data()['data']['tax_rate'] ); | ||
$this->assertEquals( 200, $response->get_status() ); | ||
} | ||
} |