public function deploy($project_id)
{
$input = ['status' => null, 'message' => null, 'project_id' => $project_id, 'user_id' => Auth::guard('api')->user()->id, 'task' => 'deploy'];
if ($this->deploymentForm->save($input)) {
$project = $this->project->byId($project_id);
$deployment = $project->getLastDeployment();
return $deployment;
} else {
throw new InvalidArgumentException($this->deploymentForm->errors());
}
}
public function test_Should_NotThrowWException_When_RollbackProcedureSucceeds() { try { $this->mockAuthGuard->shouldReceive('user')->andReturn(new App\Models\User()); Auth::shouldReceive('guard')->andReturn($this->mockAuthGuard); $this->mockDeploymentForm->shouldReceive('save')->once()->andReturn(true); $this->mockProjectModel->shouldReceive('getLastDeployment'); $this->mockProjectRepository->shouldReceive('byId')->andReturn($this->mockProjectModel); $jsonRpc = new JsonRpc($this->mockProjectRepository, $this->mockDeploymentForm); $jsonRpc->deploy(1); $this->assertTrue(true); } catch (Exception $e) { $this->fail($e->getMessage()); } }