/**
  * @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);
 }
 /**
  * @param FunctionalTester\UserSteps $I
  *
  * @actor FunctionalTester\UserSteps
  *
  * @return void
  */
 public function updateComment(FunctionalTester\UserSteps $I)
 {
     $I->am('Developer User');
     $I->wantTo('edit an existing comment');
     $admin = $I->createUser(2, 4);
     $I->login($admin->email, '123', $admin->firstname);
     $project = $I->createProject(1, [$admin]);
     $issue = $I->createIssue(1, $admin, $admin, $project);
     $comment = $I->createComment(1, $admin, $issue);
     $uri = $I->getApplication()->url->action('Project\\IssueController@postEditComment', ['comment' => $comment]);
     $I->sendAjaxPostRequest($uri, ['body' => 'Comment one updated', '_token' => csrf_token()]);
     $I->seeResponseCodeIs(200);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->see('Comment one updated', '#comment' . $comment->id . ' .content');
 }
Beispiel #3
0
 /**
  * @param FunctionalTester\UserSteps $I
  *
  * @actor FunctionalTester\UserSteps
  *
  * @return void
  */
 public function getProjectProgress(FunctionalTester\UserSteps $I)
 {
     $I->am('Admin User');
     $I->wantTo('retrieve project progress');
     $admin = $I->createUser(1, 4);
     $I->amLoggedAs($admin);
     $project1 = $I->createProject(1);
     $totalIssues = 4;
     $issues = [];
     for ($i = 0; $i < $totalIssues; $i++) {
         $issues[] = $I->createIssue($i, $admin, null, $project1);
     }
     $issues[0]->changeStatus(Project\Issue::STATUS_CLOSED, $admin);
     $expected = 1 / $totalIssues * 100;
     $I->amOnAction('ProjectController@getIssues', ['project' => $project1]);
     $uri = $I->getApplication()->url->action('ProjectsController@postProgress');
     $I->sendAjaxPostRequest($uri, ['ids' => [$project1->id], '_token' => csrf_token()]);
     $I->seeResponseCodeIs(200);
     $I->see($expected . '%');
     $issues[1]->changeStatus(Project\Issue::STATUS_CLOSED, $admin);
     $expected = 2 / $totalIssues * 100;
     $uri = $I->getApplication()->url->action('ProjectsController@postProgress');
     $I->sendAjaxPostRequest($uri, ['ids' => [$project1->id], '_token' => csrf_token()]);
     $I->seeResponseCodeIs(200);
     $I->see($expected . '%');
 }