remove deprecated tests from old bulk edit #200

This commit is contained in:
leogermani 2019-12-13 18:23:38 -03:00
parent 559e09ea31
commit 2528fd9034
1 changed files with 0 additions and 239 deletions

View File

@ -892,169 +892,6 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
$this->assertEquals(7, $count);
}
/**
* @group api
*/
function test_api_create_by_items_ids() {
$ids = array_slice($this->items_ids, 2, 17);
$request = new \WP_REST_Request(
'POST', $this->api_baseroute
);
$request->set_body( json_encode(['items_ids' => $ids]) );
$response = $this->server->dispatch($request);
$this->assertEquals(200, $response->get_status());
$data = $response->get_data();
$this->assertTrue(is_string($data['id']));
//$this->assertEquals(17, $data['items_count']);
}
/**
* @group api
*/
function test_api_create_by_query() {
$query = [
'metaquery' => [
[
'key' => $this->metadatum->get_id(),
'value' => 'odd'
]
],
'taxquery' => [
[
'taxonomy' => $this->taxonomy->get_db_identifier(),
'field' => 'name',
'terms' => 'good'
]
],
'perpage' => 4,
'paged' => 2
];
$request = new \WP_REST_Request(
'POST', $this->api_baseroute
);
//$request->set_query_params($query);
$request->set_body( json_encode(['use_query' => $query]) );
$response = $this->server->dispatch($request);
$this->assertEquals(200, $response->get_status());
$data = $response->get_data();
$this->assertTrue(is_string($data['id']));
//$this->assertEquals(20, $data['items_count']);
}
/**
* @group api
*/
public function test_api_add_action() {
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
$ids = array_slice($this->items_ids, 2, 14);
$args = ['items_ids' => $ids];
global $Tainacan_Generic_Process_Handler;
$process = $Tainacan_Generic_Process_Handler->initialize_generic_process('bulk_edit');
$process->create_bulk_edit($args);
$Tainacan_Generic_Process_Handler->save_process_instance($process);
// mimick the api endpoint
$bulk_id = $process->get_id();
$process = $Tainacan_Generic_Process_Handler->get_process_instance_by_session_id($bulk_id);
if ($process !== false) {
$bulk_edit_data = [
"value" => 'superduper',
"method" => 'add_value',
"old_value" => null,
"metadatum_id" => $this->multiple_meta->get_id(),
];
$process->set_bulk_edit_data($bulk_edit_data);
while (false !== $process->run()) {
continue;
}
}
$items = $Tainacan_Items->fetch([
'meta_query' => [
[
'key' => $this->multiple_meta->get_id(),
'value' => 'superduper'
]
],
'posts_per_page' => -1
]);
$this->assertEquals(14, $items->found_posts);
}
/**
* @group api
*/
public function test_api_set_status() {
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
$ids = array_slice($this->items_ids, 2, 14);
$args = ['items_ids' => $ids];
global $Tainacan_Generic_Process_Handler;
$process = $Tainacan_Generic_Process_Handler->initialize_generic_process('bulk_edit');
$process->create_bulk_edit($args);
$Tainacan_Generic_Process_Handler->save_process_instance($process);
// mimick the api endpoint
$bulk_id = $process->get_id();
$process = $Tainacan_Generic_Process_Handler->get_process_instance_by_session_id($bulk_id);
if ($process !== false) {
$bulk_edit_data = [
"value" => 'private',
"method" => 'set_status'
];
$process->set_bulk_edit_data($bulk_edit_data);
while (false !== $process->run()) {
continue;
}
}
$items = $Tainacan_Items->fetch([
'status' => 'private',
'posts_per_page' => -1
]);
$this->assertEquals(14, $items->found_posts);
}
/**
@ -1370,82 +1207,6 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
}
/**
* @group sequence
*/
function test_api_get_item_in_sequence() {
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
$query = [
'posts_per_page' => 22,
'orderby' => 'title',
'order' => 'ASC'
];
$bulk = new \Tainacan\Bulk_Edit([
'query' => $query,
'collection_id' => $this->collection->get_id()
]);
$request = new \WP_REST_Request(
'GET', $this->api_baseroute . '/' . $bulk->get_id() . '/sequence/7'
);
$response = $this->server->dispatch($request);
$id = $response->get_data();
$item = $Tainacan_Items->fetch($id);
$this->assertEquals('testeItem 07', $item->get_title());
}
function test_api_get_group() {
$query = [
'posts_per_page' => 22,
'orderby' => 'title',
'order' => 'ASC'
];
$args = [
'query' => $query,
'collection_id' => $this->collection->get_id()
];
global $Tainacan_Generic_Process_Handler;
$process = $Tainacan_Generic_Process_Handler->initialize_generic_process('bulk_edit');
$process->create_bulk_edit($args);
$Tainacan_Generic_Process_Handler->save_process_instance($process);
// mimick the api endpoint
$bulk_id = $process->get_id();
$request = new \WP_REST_Request(
'GET', $this->api_baseroute . '/' . $bulk_id
);
$response = $this->server->dispatch($request);
$data = $response->get_data();
$this->assertEquals($process->get_id(), $data['id']);
$this->assertEquals($process->get_options()['order'], $data['options']['order']);
$this->assertEquals($process->get_options()['orderby'], $data['options']['orderby']);
$request = new \WP_REST_Request(
'GET', $this->api_baseroute . '/fefefe23232'
);
$response = $this->server->dispatch($request);
$this->assertEquals(404, $response->get_status());
}
function test_set_multiple_tax_meta() {
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();