Example #1
0
 /**
  * Common method to get a project
  *
  * @access protected
  * @param  integer      $project_id    Default project id
  * @return array
  */
 protected function getProject($project_id = 0)
 {
     $project_id = $this->request->getIntegerParam('project_id', $project_id);
     $project = $this->project->getById($project_id);
     if (!$project) {
         $this->session->flashError(t('Project not found.'));
         $this->response->redirect('?controller=project');
     }
     $this->checkProjectPermissions($project['id']);
     return $project;
 }
Example #2
0
 public function testFlashMessage()
 {
     $h = new App($this->container);
     $s = new Session();
     $this->assertEmpty($h->flashMessage());
     $s->flash('test & test');
     $this->assertEquals('<div class="alert alert-success alert-fade-out">test &amp; test</div>', $h->flashMessage());
     $this->assertEmpty($h->flashMessage());
     $this->assertEmpty($h->flashMessage());
     $s->flashError('test & test');
     $this->assertEquals('<div class="alert alert-error">test &amp; test</div>', $h->flashMessage());
     $this->assertEmpty($h->flashMessage());
 }