2021-06-07 09:16:47 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Cart extensions route tests.
|
|
|
|
*/
|
|
|
|
|
2021-08-20 13:58:32 +00:00
|
|
|
namespace Automattic\WooCommerce\Blocks\Tests\StoreApi\Routes;
|
2021-06-07 09:16:47 +00:00
|
|
|
|
2021-08-20 13:58:32 +00:00
|
|
|
use Automattic\WooCommerce\Blocks\Tests\StoreApi\Routes\ControllerTestCase;
|
2021-06-07 09:16:47 +00:00
|
|
|
use Automattic\WooCommerce\Blocks\StoreApi\Routes\RouteException;
|
|
|
|
use Automattic\WooCommerce\Blocks\Tests\Helpers\ValidateSchema;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cart Controller Tests.
|
|
|
|
*/
|
2021-08-20 13:58:32 +00:00
|
|
|
class CartExtensions extends ControllerTestCase {
|
2021-06-07 09:16:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test getting cart with invalid namespace.
|
|
|
|
*/
|
|
|
|
public function test_post() {
|
2022-02-23 12:00:45 +00:00
|
|
|
$request = new \WP_REST_Request( 'POST', '/wc/store/v1/cart/extensions' );
|
2021-06-07 09:16:47 +00:00
|
|
|
$request->set_header( 'X-WC-Store-API-Nonce', wp_create_nonce( 'wc_store_api' ) );
|
|
|
|
$request->set_body_params(
|
|
|
|
array(
|
|
|
|
'namespace' => 'test-plugin',
|
|
|
|
)
|
|
|
|
);
|
2022-02-23 12:00:45 +00:00
|
|
|
$this->assertAPIResponse(
|
|
|
|
$request,
|
|
|
|
400
|
|
|
|
);
|
2021-06-07 09:16:47 +00:00
|
|
|
}
|
|
|
|
}
|