createUser([ 'userName' => 'admin-test', 'type' => 'admin', ]); $this->auth('admin-test'); $app = $this->createApplication(); $processor = $app->getContainer() ->get('injectableFactory') ->create(ControllerActionProcessor::class); $data = [ 'userName' => 'test', 'lastName' => 'Test', 'password' => '1', ]; $request = $this->createRequest( 'POST', [], ['Content-Type' => 'application/json'], json_encode($data) ); $response = $this->createMock(ResponseWrapper::class); $response ->expects($this->once()) ->method('writeBody'); $processor->process('User', 'create', $request, $response); } public function testCreateTeam() { $this->createUser([ 'userName' => 'admin-test', 'type' => 'admin', ]); $this->auth('admin-test'); $app = $this->createApplication(); $processor = $app->getContainer() ->get('injectableFactory') ->create(ControllerActionProcessor::class); $data = [ 'name' => 'test', ]; $request = $this->createRequest( 'POST', [], ['Content-Type' => 'application/json'], json_encode($data) ); $response = $this->createMock(ResponseWrapper::class); $response ->expects($this->once()) ->method('writeBody'); $processor->process('Team', 'create', $request, $response); } public function testCreateRole() { $this->createUser([ 'userName' => 'admin-test', 'type' => 'admin', ]); $this->auth('admin-test'); $app = $this->createApplication(); $processor = $app->getContainer() ->get('injectableFactory') ->create(ControllerActionProcessor::class); $data = [ 'name' => 'test', ]; $request = $this->createRequest( 'POST', [], ['Content-Type' => 'application/json'], json_encode($data) ); $response = $this->createMock(ResponseWrapper::class); $response ->expects($this->once()) ->method('writeBody'); $processor->process('Role', 'create', $request, $response); } public function testCreatePortal() { $this->createUser([ 'userName' => 'admin-test', 'type' => 'admin', ]); $this->auth('admin-test'); $app = $this->createApplication(); $processor = $app->getContainer() ->get('injectableFactory') ->create(ControllerActionProcessor::class); $data = [ 'name' => 'test', ]; $request = $this->createRequest( 'POST', [], ['Content-Type' => 'application/json'], json_encode($data) ); $response = $this->createMock(ResponseWrapper::class); $response ->expects($this->once()) ->method('writeBody'); $processor->process('Portal', 'create', $request, $response); } }