Exemple #1
0
 /**
  * Delete a build.
  */
 public function delete($buildId)
 {
     $this->requireAdmin();
     $build = BuildFactory::getBuildById($buildId);
     if (empty($build)) {
         throw new NotFoundException(Lang::get('build_x_not_found', $buildId));
     }
     $this->buildService->deleteBuild($build);
     header('Location: ' . PHPCI_URL . 'project/view/' . $build->getProjectId());
     exit;
 }
Exemple #2
0
 /**
  * Delete a build.
  */
 public function delete($buildId)
 {
     $this->requireAdmin();
     $build = BuildFactory::getBuildById($buildId);
     if (empty($build)) {
         throw new NotFoundException(Lang::get('build_x_not_found', $buildId));
     }
     $this->buildService->deleteBuild($build);
     $response = new b8\Http\Response\RedirectResponse();
     $response->setHeader('Location', PHPCI_URL . 'project/view/' . $build->getProjectId());
     return $response;
 }
Exemple #3
0
 /**
  * Delete a build.
  */
 public function delete($buildId)
 {
     if (empty($_SESSION['user']) || !$_SESSION['user']->getIsAdmin()) {
         throw new \Exception('You do not have permission to do that.');
     }
     $build = BuildFactory::getBuildById($buildId);
     if (empty($build)) {
         throw new NotFoundException('Build with ID: ' . $buildId . ' does not exist.');
     }
     $this->buildService->deleteBuild($build);
     header('Location: ' . PHPCI_URL . 'project/view/' . $build->getProjectId());
     exit;
 }
Exemple #4
0
 /**
  * @covers PHPUnit::execute
  */
 public function testExecute_DeleteBuild()
 {
     $store = $this->getMock('PHPCI\\Store\\BuildStore');
     $store->expects($this->once())->method('delete')->will($this->returnValue(true));
     $service = new BuildService($store);
     $build = new Build();
     $this->assertEquals(true, $service->deleteBuild($build));
 }