user already set at super class

This commit is contained in:
Jacson Passold 2018-01-08 19:30:26 -02:00
parent 441d337f26
commit 2851d8b545
2 changed files with 2 additions and 12 deletions

View File

@ -20,21 +20,9 @@ class TAINACAN_UnitApiTestCase extends TAINACAN_UnitTestCase {
*/
protected $namespace = '/tainacan/v2';
protected $user_id;
public function setUp(){
parent::setUp();
// Create a Administrator user for test api with cookie authentication
$this->user_id = $this->factory->user->create(
array(
'role' => 'administrator'
)
);
// Set that user as current user
wp_set_current_user( $this->user_id );
global $wp_rest_server;
$this->server = $wp_rest_server = new \WP_REST_Server;

View File

@ -8,6 +8,7 @@ class TAINACAN_UnitTestCase extends \WP_UnitTestCase {
protected $tainacan_entity_factory;
protected $tainacan_field_factory;
protected $tainacan_filter_factory;
protected $user_id;
public function setUp(){
parent::setUp();
@ -17,5 +18,6 @@ class TAINACAN_UnitTestCase extends \WP_UnitTestCase {
$new_admin_user = $this->factory()->user->create(array( 'role' => 'administrator' ));
wp_set_current_user($new_admin_user);
$this->user_id = $new_admin_user;
}
}