function test_doApiCall() { RemoteSyncPlugin::instance()->install(); $id = wp_insert_post(array("post_title" => "hello", "post_type" => "post", "post_content" => "something", "post_name" => "the-name")); update_option('rs_access_key', "test"); $api = new RemoteSyncApi(); // test listing with the right key $ls_res1 = array(); $args = array("key" => "test", "type" => "post", "version" => 2); $ls_res1 = $api->doApiCall("ls", $args); //print_r($ls_res1); //test listing with the wrong key $ls_res2 = array(); $args = array("key" => "Wrong Key", "type" => "post"); $ls_res2 = $api->doApiCall("ls", $args); //print_r($ls_res2); // test deleting with wrong key $del_res1 = array(); $args = array("key" => "wrong key", "type" => "post", "slug" => $ls_res1[0]["slug"]); $del_res1 = $api->doApiCall("del", $args); //print_r($del_res1); // test deleting with right key $del_res1 = array(); $args = array("key" => "test", "type" => "post", "slug" => $ls_res1[0]["slug"], "version" => 2); $del_res1 = $api->doApiCall("del", $args); //print_r($del_res1); }