Add WooCommerceSettings endpoint
[MAILPOET-2278]
This commit is contained in:
committed by
Jack Kitterhing
parent
af902e93f4
commit
86cffacdbe
37
tests/integration/API/JSON/v1/WoocommerceSettingsTest.php
Normal file
37
tests/integration/API/JSON/v1/WoocommerceSettingsTest.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\Test\API\JSON\v1;
|
||||
|
||||
use MailPoet\API\JSON\Response as APIResponse;
|
||||
use MailPoet\API\JSON\v1\WoocommerceSettings;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
class WoocommerceSettingsTest extends \MailPoetTest {
|
||||
|
||||
/** @var WoocommerceSettings */
|
||||
private $endpoint;
|
||||
|
||||
/** @var WPFunctions */
|
||||
private $wp;
|
||||
|
||||
function _before() {
|
||||
$this->wp = new WPFunctions();
|
||||
$this->endpoint = new WoocommerceSettings($this->wp);
|
||||
}
|
||||
function testItCanSetSettings() {
|
||||
$this->wp->updateOption('woocommerce_email_base_color', '#ffffff');
|
||||
$response = $this->endpoint->set([
|
||||
'woocommerce_email_base_color' => '#aaaaaa',
|
||||
]);
|
||||
expect($response->status)->equals(APIResponse::STATUS_OK);
|
||||
expect($this->wp->getOption('woocommerce_email_base_color'))->equals('#aaaaaa');
|
||||
}
|
||||
|
||||
function testItDoesNotSetUnallowedSettings() {
|
||||
$response = $this->endpoint->set([
|
||||
'mailpoet_some_none_exting_option' => 'some value',
|
||||
]);
|
||||
expect($response->status)->equals(APIResponse::STATUS_OK);
|
||||
expect($this->wp->getOption('mailpoet_some_none_exting_option', null))->equals(null);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user