/** * Check dependencies and boot the API if possible. * * @since 0.1.0 * * @uses "rest_api_init" */ function cwp_swp_api_boot() { if (class_exists('SWP_Query') && defined('REST_API_VERSION') && version_compare(REST_API_VERSION, '2.0-beta2', '>=')) { $api = new calderawp\swp_api\route('post'); $api->the_route(); } }
/** * Test the validate_date_query() method will properly validate a date query * * @since 0.2.0 * * @covers \calderawp\swp_api\route::validate_date_query() */ public function test_validate_date_query() { $class = new \calderawp\swp_api\route('swp-api'); $query = array('year' => 1, 'month' => 2, 'day' => '3'); $this->assertTrue($class->validate_date_query($query)); $query = array('value' => 'pippin'); $this->assertFalse($class->validate_date_query($query)); }