public function testUnpublishPostValid() { $jwt = DataMock::getJwt(); $this->setAdminToken($jwt); $request = new RequestMock(); $request->header = [$jwt]; $post = R::dispense('post'); $post->title = 'Test'; $post->user_id = 1; $post->is_published = false; R::store($post); $args = []; $args['id'] = 1; $response = $this->admin->unpublishPost($request, new ResponseMock(), $args); $this->assertEquals('success', $response->status); $this->assertEquals('Post Test unpublished.', $response->alerts[0]['text']); }
public function testAuthenticateValid() { Auth::CreateInitialAdmin(new ContainerMock()); $jwt = DataMock::getJwt(); $user = R::load('user', 1); $user->active_token = $jwt; R::store($user); $request = new RequestMock(); $request->header = [$jwt]; $response = $this->auth->authenticate($request, new ResponseMock(), null); $this->assertEquals('success', $response->status); }