fix one test. waiting for others #200

This commit is contained in:
leogermani 2019-12-06 19:59:42 -03:00
parent 41c0120ca3
commit f6527c5067
1 changed files with 165 additions and 153 deletions

View File

@ -981,19 +981,31 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
'items_ids' => $ids,
]);
$body = json_encode([
'metadatum_id' => $this->multiple_meta->get_id(),
'value' => 'superduper'
]);
global $Tainacan_Generic_Process_Handler;
$process = $Tainacan_Generic_Process_Handler->initialize_generic_process('bulk_edit', $bulk->get_id());
$Tainacan_Generic_Process_Handler->save_process_instance($process);
// mimick the api endpoint
$bulk_id = $bulk->get_id();
$request = new \WP_REST_Request(
'POST', $this->api_baseroute . '/' . $bulk->get_id() . '/add'
);
$process = $Tainacan_Generic_Process_Handler->get_process_instance_by_session_id($bulk_id);
var_dump($process);
var_dump($bulk_id);
if ($process !== false) {
$bulk_edit_data = [
"value" => 'superduper',
"method" => 'add_value',
//"old_value" => isset($body['old_value']) ? $body['old_value'] : null,
"metadatum_id" => $this->multiple_meta->get_id(),
];
$process->set_bulk_edit_data($bulk_edit_data);
$request->set_body( $body );
while (false !== $process->run()) {
var_dump('run');
continue;
}
$response = $this->server->dispatch($request);
}
$items = $Tainacan_Items->fetch([
'meta_query' => [