add prototype of jsondl test case

This commit is contained in:
Jacson Passold 2018-07-09 18:23:45 -03:00
parent 49c668cc1e
commit 118765ed95
1 changed files with 50 additions and 0 deletions

View File

@ -433,6 +433,56 @@ class TAINACAN_REST_Exposers extends TAINACAN_UnitApiTestCase {
}
/**
* @group json_dl_exposer
*/
public function test_jsondl_exposer() {
global $Tainacan_Metadata, $Tainacan_Item_Metadata;
extract($this->create_meta_requirements());
$item__metadata_json = json_encode([
'values' => 'TestValues_exposers',
]);
$request = new \WP_REST_Request('POST', $this->namespace . '/item/' . $this->item->get_id() . '/metadata/' . $this->metadatum->get_id() );
$request->set_body($item__metadata_json);
$response = $this->server->dispatch($request);
$this->assertEquals(200, $response->get_status());
$data = $response->get_data();
$this->assertEquals($this->item->get_id(), $data['item']['id']);
$this->assertEquals('TestValues_exposers', $data['value']);
/*$item_exposer_json = json_encode([
'exposer-type' => 'json-ld',
]);
$request = new \WP_REST_Request('GET', $this->namespace . '/item/' . $this->item->get_id() . '/metadata/'. $this->metadatum->get_id() );
$request->set_body($item_exposer_json);
$response = $this->server->dispatch($request);
$this->assertEquals(200, $response->get_status());
$data = $response->get_data();
var_dump($data);*/
$item_exposer_json = json_encode([
'exposer-type' => 'json-ld',
'exposer_map' => 'dublin-core',
]);
$request = new \WP_REST_Request('GET', $this->namespace . '/item/' . $this->item->get_id() . '/metadata' );
$request->set_body($item_exposer_json);
$response = $this->server->dispatch($request);
$this->assertEquals(200, $response->get_status());
$data = $response->get_data();
var_dump($data);
}
}
?>