diff --git a/src/API/Site/Controllers/MerchantCenter/SettingsController.php b/src/API/Site/Controllers/MerchantCenter/SettingsController.php index e9ffac77e4..64dcad9d0d 100644 --- a/src/API/Site/Controllers/MerchantCenter/SettingsController.php +++ b/src/API/Site/Controllers/MerchantCenter/SettingsController.php @@ -130,6 +130,7 @@ protected function get_schema_properties(): array { 'destination', 'manual', ], + 'default' => 'destination', ], 'website_live' => [ 'type' => 'boolean', diff --git a/tests/Unit/API/Site/Controllers/MerchantCenter/SettingsControllerTest.php b/tests/Unit/API/Site/Controllers/MerchantCenter/SettingsControllerTest.php new file mode 100644 index 0000000000..f0bc4bcbf0 --- /dev/null +++ b/tests/Unit/API/Site/Controllers/MerchantCenter/SettingsControllerTest.php @@ -0,0 +1,47 @@ +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() ); + } +}