/** * this is run before each test* function in this class, to set * up the environment each test runs in. */ public function setUp() { parent::setUp(); $this->admin_user_id = $this->factory->user->create(array('role' => 'administrator')); wp_set_current_user($this->admin_user_id); }