Verified Commit ae62d234 authored by Erick Hitter's avatar Erick Hitter
Browse files

First proper REST test

parent d07c2b33
......@@ -8,13 +8,37 @@
/**
* Sample test case.
*/
class WPCCR_REST_API_Test extends WP_UnitTestCase {
class WPCCR_REST_API_Test extends WP_Test_REST_Controller_Testcase {
public function test_register_routes() {}
public function test_context_param() {}
/**
* A single example test.
* Test that event-list endpoint lists events
*/
function test_events_list_endpoint() {
// Replace this with some actual testing code.
$this->assertTrue( true );
public function test_get_items() {
$request = new WP_REST_Request( 'POST', WP_Cron_Control_Revisited\REST_API_NAMESPACE . '/' . WP_Cron_Control_Revisited\REST_API_ENDPOINT_LIST );
$request->set_body_params( array( 'secret' => WP_CRON_CONTROL_SECRET, ) );
$response = $this->server->dispatch( $request );
$data = $response->get_data();
$this->assertEquals( 200, $response->get_status() );
$this->assertArrayHasKey( 'events', $data );
$this->assertArrayHasKey( 'endpoint', $data );
}
public function test_get_item() {}
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() {}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment