fix tests

This commit is contained in:
Leo Germani 2018-09-18 14:16:10 -03:00
parent 887b74b16f
commit 1d868802f9
2 changed files with 7 additions and 3 deletions

View File

@ -164,7 +164,7 @@ class REST_Controller extends \WP_REST_Controller {
foreach ( $request_meta_query as $index1 => $a ) {
// handle core metadatum
if( is_array($a) && array_key_exists("key", $a) && !$request['advancedSearch'] ){
if( is_array($a) && array_key_exists("key", $a) && ( !isset($request['advancedSearch']) || !$request['advancedSearch'] ) ){
$metadatum = new \Tainacan\Entities\Metadatum($a['key']);
if( strpos( $metadatum->get_metadata_type(), 'Core_Title') !== false ){
$args[ 'post_title_in' ] = [

View File

@ -948,9 +948,9 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
'POST', $this->api_baseroute
);
$request->set_query_params($query);
//$request->set_query_params($query);
$request->set_body( json_encode(['use_query' => 1]) );
$request->set_body( json_encode(['use_query' => $query]) );
$response = $this->server->dispatch($request);
@ -1128,6 +1128,10 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
'items_ids' => $ids,
]);
$this->assertEquals( 0, $bulk->delete_items(), 'Items must be on trash to be deleted' );
$bulk->trash_items();
$this->assertEquals( 17, $bulk->delete_items() );
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();