Misc cleanup.
This commit is contained in:
parent
6c2be482ca
commit
06e787a26d
|
@ -129,7 +129,8 @@ class WC_Rest_Settings_Controller extends WP_Rest_Controller {
|
|||
array_flip( array_filter( array_keys( $location ), array( $this, 'filter_location_keys' ) ) )
|
||||
);
|
||||
|
||||
return $filtered_location;
|
||||
$response = rest_ensure_response( $filtered_location );
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -118,7 +118,6 @@ class WC_Unit_Tests_Bootstrap {
|
|||
* WP-API
|
||||
* @todo to be removed when the wp-api branch is merged.
|
||||
*/
|
||||
require_once( $this->tests_dir . '/framework/class-wp-test-rest-controller-testcase.php' );
|
||||
require_once( $this->tests_dir . '/framework/class-wp-test-spy-rest-server.php' );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @todo to be removed when the wp-api branch is merged.
|
||||
* @version 2.0-beta12
|
||||
*/
|
||||
abstract class WP_Test_REST_Controller_Testcase extends WP_Test_REST_TestCase {
|
||||
|
||||
protected $server;
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
/** @var WP_REST_Server $wp_rest_server */
|
||||
global $wp_rest_server;
|
||||
$this->server = $wp_rest_server = new WP_Test_Spy_REST_Server;
|
||||
do_action( 'rest_api_init' );
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
|
||||
/** @var WP_REST_Server $wp_rest_server */
|
||||
global $wp_rest_server;
|
||||
$wp_rest_server = null;
|
||||
}
|
||||
|
||||
abstract public function test_register_routes();
|
||||
|
||||
abstract public function test_context_param();
|
||||
|
||||
abstract public function test_get_items();
|
||||
|
||||
abstract public function test_get_item();
|
||||
|
||||
abstract public function test_create_item();
|
||||
|
||||
abstract public function test_update_item();
|
||||
|
||||
abstract public function test_delete_item();
|
||||
|
||||
abstract public function test_prepare_item();
|
||||
|
||||
abstract public function test_get_item_schema();
|
||||
|
||||
}
|
|
@ -6,10 +6,18 @@ namespace WooCommerce\Tests\API;
|
|||
* @package WooCommerce\Tests\API
|
||||
* @since 2.7.0
|
||||
*/
|
||||
class Settings extends \WP_Test_REST_Controller_Testcase {
|
||||
class Settings extends \WC_Unit_Test_Case {
|
||||
|
||||
protected $server;
|
||||
|
||||
/**
|
||||
* Setup our test server, endpoints, and user info.
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
global $wp_rest_server;
|
||||
$this->server = $wp_rest_server = new \WP_Test_Spy_REST_Server;
|
||||
do_action( 'rest_api_init' );
|
||||
$this->endpoint = new \WC_Rest_Settings_Controller();
|
||||
\WC_Helper_Settings::register();
|
||||
$this->user = $this->factory->user->create( array(
|
||||
|
@ -17,6 +25,15 @@ class Settings extends \WP_Test_REST_Controller_Testcase {
|
|||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the server.
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
global $wp_rest_server;
|
||||
$wp_rest_server = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test route registration.
|
||||
* @since 2.7.0
|
||||
|
@ -167,15 +184,6 @@ class Settings extends \WP_Test_REST_Controller_Testcase {
|
|||
$this->assertEquals( 401, $response->get_status() );
|
||||
}
|
||||
|
||||
public function test_get_items() { }
|
||||
public function test_get_item() { }
|
||||
public function test_context_param() { }
|
||||
public function test_create_item() { }
|
||||
public function test_update_item() { }
|
||||
public function test_delete_item() { }
|
||||
public function test_prepare_item() { }
|
||||
public function test_get_item_schema() { }
|
||||
|
||||
/**
|
||||
* Ensure valid location data response.
|
||||
* @since 2.7.0
|
||||
|
|
Loading…
Reference in New Issue