/**
  * @param FunctionalTester\UserSteps $I
  *
  * @actor FunctionalTester\UserSteps
  *
  * @return void
  */
 public function addProject(FunctionalTester\UserSteps $I)
 {
     $I->am('Admin User');
     $I->wantTo('add new project');
     $admin = $I->createUser(1, 4);
     $I->createUser(2, 2);
     // developer
     $I->createUser(3, 1);
     // user
     $I->login($admin->email, '123', $admin->firstname);
     $I->sendAjaxGetRequest($I->getApplication()->url->action('ProjectController@getInactiveUsers'));
     $users = (array) $I->getJsonResponseContent();
     $userId1 = key($users);
     $userName1 = current($users);
     next($users);
     next($users);
     $userId2 = key($users);
     $userName2 = current($users);
     $I->amOnAction('ProjectsController@getNew');
     $I->fillField('name', 'project1');
     $params = ['user' => [$userId1 => $userId1, $userId2 => $userId2], 'name' => 'project1', 'default_assignee' => $userId2];
     $I->submitForm('#submit-project', $params);
     $project = $I->fetchProjectBy('name', 'project1');
     $I->seeCurrentActionIs('ProjectController@getIndex', ['project' => $project]);
     $I->see($userName1, '//li[@id="project-user' . $userId1 . '"]');
     $I->see($userName2, '//li[@id="project-user' . $userId2 . '"]');
 }
 /**
  * @param FunctionalTester\UserSteps $I
  *
  * @actor FunctionalTester\UserSteps
  *
  * @return void
  */
 public function addIssue(FunctionalTester\UserSteps $I)
 {
     $I->am('Admin User');
     $I->wantTo('add new issue to a project');
     $admin = $I->createUser(1, 4);
     $developer1 = $I->createUser(2, 2);
     // developer
     $I->login($admin->email, '123', $admin->firstname);
     $project = $I->createProject(1, [$developer1]);
     $I->sendAjaxGetRequest($I->getApplication()->url->action('Administration\\TagsController@getTags', ['term' => 'f']));
     $tags = new Collection((array) $I->getJsonResponseContent());
     $I->amOnAction('Project\\IssueController@getNew', ['project' => $project]);
     $I->seeOptionIsSelected('assigned_to', $developer1->fullname);
     $params = ['title' => 'issue 1', 'body' => 'body of issue 1', 'tag' => $tags->forPage(0, 2)->implode('value', ','), 'assigned_to' => $developer1->id, 'time_quote' => ['h' => 1, 'm' => 2, 's' => 3]];
     $I->submitForm('#content .form-horizontal', $params);
     $issue = $I->fetchIssueBy('title', $params['title']);
     $I->seeCurrentActionIs('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->seeResponseCodeIs(200);
     $I->seeLink($params['title']);
     $I->see($params['body'], '.content');
     $I->see(\Html::duration($issue->time_quote), '.issue-quote');
     foreach ($tags->forPage(0, 2) as $tag) {
         $segments = explode(':', $tag->label);
         $I->see($segments[0], '.issue-tag');
         $I->see($segments[1], '.issue-tag');
     }
 }
Exemple #3
0
 /**
  * @param FunctionalTester\UserSteps $I
  *
  * @actor FunctionalTester\UserSteps
  *
  * @return void
  */
 public function redirectToDashboard(FunctionalTester\UserSteps $I)
 {
     $I->am('logged in user');
     $I->wantTo('be redirected to dashboard on viewing login.');
     $I->amLoggedAs($I->createUser(1));
     $I->amOnAction('HomeController@getIndex');
     $I->seeCurrentActionIs('HomeController@getDashboard');
     $I->see(trans('tinyissue.dashboard'));
 }
 /**
  * @param \FunctionalTester\UserSteps $I
  *
  * @actor FunctionalTester\UserSteps
  *
  * @return void
  */
 public function createIssues(FunctionalTester\UserSteps $I)
 {
     $I->am('Normal User');
     $I->expectTo('create issues in projects I am one of the users');
     $user = $I->createUser(1, 1);
     $project1 = $I->createProject(1);
     $project2 = $I->createProject(2, [$user]);
     $I->login($user->email, '123', $user->firstname);
     $I->sendAjaxGetRequest($I->getApplication()->url->action('Administration\\TagsController@getTags', ['term' => 'f']));
     $tags = new Collection((array) $I->getJsonResponseContent());
     $params = ['title' => 'issue 1', 'body' => 'body of issue 1', 'tag' => $tags->forPage(0, 1)->implode('value', ',')];
     $I->amOnAction('Project\\IssueController@getNew', ['project' => $project2]);
     $I->seeResponseCodeIs(200);
     $I->submitForm('#content .form-horizontal', $params);
     $issue = $I->fetchIssueBy('title', $params['title']);
     $I->seeCurrentActionIs('Project\\IssueController@getIndex', ['project' => $project2, 'issue' => $issue]);
     $I->seeResponseCodeIs(200);
     $I->seeLink($params['title']);
     $I->amOnAction('Project\\IssueController@getNew', ['project' => $project1]);
     $I->seeResponseCodeIs(401);
 }
 /**
  * @param \FunctionalTester\UserSteps $I
  *
  * @actor FunctionalTester\UserSteps
  *
  * @return void
  */
 public function addCommentToIssue(FunctionalTester\UserSteps $I)
 {
     $I->am('Manager User');
     $I->expectTo('add comments to all issues in all projects');
     $user = $I->createUser(1, 3);
     $admin = $I->createUser(2, 4);
     $project1 = $I->createProject(1);
     $project2 = $I->createProject(2, [$user]);
     $issue1 = $I->createIssue(1, $admin, null, $project1);
     $issue2 = $I->createIssue(2, $admin, null, $project2);
     $I->amLoggedAs($user);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project2, 'issue' => $issue2]);
     $I->fillField('comment', 'Comment one');
     $I->click(trans('tinyissue.comment'));
     $I->seeResponseCodeIs(200);
     $comment = $issue2->comments->last();
     $I->seeCurrentActionIs('Project\\IssueController@getIndex', ['project' => $project2, 'issue' => $issue2->id . '#comment' . $comment->id]);
     $I->see('Comment one', '.comment .content');
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project1, 'issue' => $issue1]);
     $I->see(trans('tinyissue.comment_on_this_issue'));
     $I->sendPostRequest('Project\\IssueController@getAddComment', ['project' => $project1, 'issue' => $issue1], ['comment' => 'Comment 1', '_token' => csrf_token(), 'upload_token' => '-']);
     $I->seeResponseCodeIs(200);
 }