/**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function viewIssues(FunctionalTester $I)
 {
     $I->am('Manager User');
     $I->expectTo('view 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);
     $comment1 = $I->createComment(1, $admin, $issue2);
     $I->amLoggedAs($user);
     $I->amOnAction('HomeController@getIndex');
     $I->see($project2->name, '#sidebar .project');
     $I->dontSee($project1->name, '#sidebar .project');
     $I->click($project2->name);
     $I->seeCurrentActionIs('ProjectController@getIndex', ['project' => $project2]);
     $I->seeLink($issue2->title);
     $I->dontSeeLink($issue1->title);
     $I->click($issue2->title);
     $I->seeCurrentActionIs('Project\\IssueController@getIndex', ['project' => $project2, 'issue' => $issue2]);
     $I->see($comment1->comment, '#comment' . $comment1->id . ' .content');
     $I->amOnAction('Project\\IssueController@getNew', ['project' => $project1]);
     $I->seeResponseCodeIs(200);
     $I->click(trans('tinyissue.projects'));
     $I->see($project1->name);
     $I->see($project2->name);
 }
 /**
  * @param FunctionalTester $I
  * @param bool             $assignIssuesToDev
  *
  * @return array
  */
 protected function _createData(FunctionalTester $I, $assignIssuesToDev = false)
 {
     $manager = $I->createUser(1, 3);
     $developer = null;
     if ($assignIssuesToDev) {
         $developer = $I->createUser(2, 2);
     }
     $project = $I->createProject(1);
     $issues1 = [$I->createIssue(1, $manager, $developer, $project), $I->createIssue(11, $manager, $developer, $project)];
     $issues2 = [$I->createIssue(2, $manager, null, $project), $I->createIssue(21, $manager, null, $project), $I->createIssue(22, $manager, null, $project)];
     return [$manager, $project, $issues1, $issues2, $developer];
 }
Esempio n. 3
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function viewAssignedTo(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('view issues assigned to logged user');
     $admin = $I->createUser(1, 4);
     $developer1 = $I->createUser(2, 2);
     $I->amLoggedAs($developer1);
     $project1 = $I->createProject(1);
     $issue1 = $I->createIssue(1, $admin, $developer1, $project1);
     $issue2 = $I->createIssue(2, $admin, $developer1, $project1);
     $issue3 = $I->createIssue(3, $admin, null, $project1);
     $I->amOnAction('ProjectController@getAssigned', ['project' => $project1]);
     $I->seeLink($issue1->title);
     $I->seeLink($issue2->title);
     $I->dontSeeLink($issue3->title);
 }
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function viewOverview(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('To view administration overview page');
     $admin = $I->createUser(1, 4);
     $project1 = $I->createProject(1);
     $project2 = $I->createProject(2);
     $project2->status = Tinyissue\Model\Project::STATUS_ARCHIVED;
     $project2->save();
     $I->createProject(3);
     $I->createIssue(1, $admin, null, $project1);
     $I->createIssue(2, $admin, null, $project1);
     $issue3 = $I->createIssue(3, $admin, null, $project1);
     $issue3->changeStatus(Project\Issue::STATUS_CLOSED, $admin);
     $I->amLoggedAs($admin);
     $I->amOnAction('HomeController@getIndex');
     $I->click(trans('tinyissue.administration'));
     $I->seeCurrentActionIs('AdministrationController@getIndex');
     $I->see('1', '//li[@class="list-group-item" and text()[contains(.,\'' . trans('tinyissue.total_users') . '\')]]/span');
     $I->see('2', '//li[@class="list-group-item" and text()[contains(.,\'' . trans('tinyissue.active_projects') . '\')]]/span');
     $I->see('1', '//li[@class="list-group-item" and text()[contains(.,\'' . trans('tinyissue.archived_projects') . '\')]]/span');
     $I->see('2', '//li[@class="list-group-item" and text()[contains(.,\'' . trans('tinyissue.open_issues') . '\')]]/span');
     $I->see('1', '//li[@class="list-group-item" and text()[contains(.,\'' . trans('tinyissue.closed_issues') . '\')]]/span');
 }
 public function viewInvalidIssue(FunctionalTester $I)
 {
     $I->am('Normal User');
     $I->expectTo('see 401 error with mismatch issue route parameters.');
     $user1 = $I->createUser(2, 1);
     // user
     $project1 = $I->createProject(1, [$user1]);
     $project2 = $I->createProject(2, [$user1]);
     $issue1 = $I->createIssue(1, $user1, null, $project1);
     $I->amLoggedAs($user1);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project2, 'issue' => $issue1]);
     $I->seeResponseCodeIs(401);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project1, 'issue' => $issue1]);
     $I->seeResponseCodeIs(200);
 }
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function updateIssue(FunctionalTester $I)
 {
     $I->am('Developer User');
     $I->expectTo('edit an existing project issue details');
     $user = $I->createUser(1, 2);
     $admin = $I->createUser(2, 4);
     $project = $I->createProject(1, [$user]);
     $issue = $I->createIssue(1, $admin, null, $project);
     $I->amLoggedAs($user);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->click($issue->title, '.edit-issue');
     $I->seeCurrentActionIs('Project\\IssueController@getEdit', ['project' => $project, 'issue' => $issue]);
     $newTitle = $issue->title . ' update';
     $I->fillField('title', $newTitle);
     $I->click(trans('tinyissue.update_issue'));
     $I->seeResponseCodeIs(200);
     $I->seeCurrentActionIs('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->seeLink($newTitle);
 }
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function deleteComment(FunctionalTester $I)
 {
     $I->am('Developer User');
     $I->wantTo('delete a comment from an issue');
     $admin = $I->createUser(2, 4);
     $I->amLoggedAs($admin);
     $project = $I->createProject(1, [$admin]);
     $issue = $I->createIssue(1, $admin, $admin, $project);
     $comment1 = $I->createComment(1, $admin, $issue);
     $comment2 = $I->createComment(2, $admin, $issue);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->see($comment1->comment, '#comment' . $comment1->id . ' .content');
     $I->see($comment2->comment, '#comment' . $comment2->id . ' .content');
     $uri = $I->getApplication()->url->action('Project\\IssueController@getDeleteComment', ['comment' => $comment1]);
     $I->sendAjaxGetRequest($uri);
     $I->seeResponseCodeIs(200);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->dontSee($comment1->comment);
     $I->see($comment2->comment);
 }
Esempio n. 8
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function viewIssues(FunctionalTester $I)
 {
     $I->am('Developer User');
     $I->wantTo('view issues assigned to logged user in all projects');
     $admin = $I->createUser(1, 4);
     $developer1 = $I->createUser(2, 2);
     $I->amLoggedAs($developer1);
     $project1 = $I->createProject(1, [$developer1]);
     $issue1 = $I->createIssue(1, $admin, $developer1, $project1);
     $issue2 = $I->createIssue(2, $admin, $developer1, $project1);
     $issue3 = $I->createIssue(3, $developer1, $developer1, $project1);
     $project2 = $I->createProject(2, [$developer1]);
     $issue4 = $I->createIssue(4, $admin, $developer1, $project2);
     $issue5 = $I->createIssue(5, $admin, $developer1, $project2);
     $issue6 = $I->createIssue(6, $admin, null, $project2);
     $I->amOnAction('HomeController@getIndex');
     $I->click(trans('tinyissue.your_issues'));
     $I->seeLink($issue1->title);
     $I->seeLink($issue2->title);
     $I->seeLink($issue3->title);
     $I->seeLink($issue4->title);
     $I->seeLink($issue5->title);
     $I->dontSeeLink($issue6->title);
 }
 /**
  * @param \FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function cantCreateComment(FunctionalTester $I)
 {
     $I->am('Normal User');
     $I->expectTo('not be able to add comment to an issue');
     $user = $I->createUser(2, 1);
     $admin = $I->createUser(1, 4);
     $issue = $I->createIssue(1, $admin);
     $issue2 = $I->createIssue(2, $admin, null, $I->createProject(1, [$user]));
     $I->amLoggedAs($user);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $issue->project, 'issue' => $issue]);
     $I->dontSee(trans('tinyissue.comment_on_this_issue'));
     $I->sendPostRequest('Project\\IssueController@getAddComment', ['project' => $issue->project, 'issue' => $issue], ['comment' => 'Comment 1', '_token' => csrf_token()]);
     $I->seeResponseCodeIs(401);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $issue2->project, 'issue' => $issue2]);
     $I->dontSee(trans('tinyissue.comment_on_this_issue'));
     $I->sendPostRequest('Project\\IssueController@getAddComment', ['project' => $issue2->project, 'issue' => $issue2], ['comment' => 'Comment 1', '_token' => csrf_token()]);
     $I->seeResponseCodeIs(401);
 }
Esempio n. 10
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function assignToUser(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('not be able to assign an issue to a user');
     $admin = $I->createUser(1, 4);
     $developer1 = $I->createUser(2, 2);
     // developer
     $I->amLoggedAs($admin);
     $project = $I->createProject(1, [$developer1]);
     $issue = $I->createIssue(1, $admin, null, $project);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->dontSee($developer1->fullname, '.assigned-to .currently_assigned');
     $uri = $I->getApplication()->url->action('Project\\IssueController@postAssign', ['project' => $project]);
     $I->sendAjaxPostRequest($uri, ['user_id' => $developer1->id, '_token' => csrf_token()]);
     $I->comment($I->getResponseContent());
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->see($developer1->fullname, '.assigned-to .currently_assigned');
 }
Esempio n. 11
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function removeAttachment(FunctionalTester $I)
 {
     $I->am('Manager User');
     $I->wantTo('remove an attachment from a project issue comments');
     $fileName = 'upload1.txt';
     $manager = $I->createUser(1, 3);
     $I->amLoggedAs($manager);
     $issue = $I->createIssue(1, $manager);
     $project = $issue->project;
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $uploadToken = $I->grabValueFrom('//form/input[@name="upload_token"]');
     $uri = $I->getApplication()->url->action('Project\\IssueController@postUploadAttachment', ['project' => $project]);
     $I->submitFormWithFileToUri('.new-comment form', $uri, ['upload' => $fileName], ['comment' => 'Comment 1']);
     $attachment = $issue->comments->first()->attachments->first();
     $I->amOnAction('Project\\IssueController@getDownloadAttachment', ['project' => $project, 'issue' => $issue, 'attachment' => $attachment]);
     $I->seeResponseCodeIs(200);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->seeElement('.attachments a', ['title' => $fileName]);
     $uri = $I->getApplication()->url->action('Project\\IssueController@postRemoveAttachment', ['project' => $project]);
     $I->sendAjaxPostRequest($uri, ['_token' => csrf_token(), 'upload_token' => $uploadToken, 'filename' => $fileName]);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->dontSeeElement('.attachments a', ['title' => $fileName]);
     $I->amOnAction('Project\\IssueController@getDisplayAttachment', ['project' => $project, 'issue' => $issue, 'attachment' => $attachment]);
     $I->seeResponseCodeIs(404);
 }
Esempio n. 12
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function closeIssue(FunctionalTester $I)
 {
     $I->am('Developer User');
     $I->wantTo('close an opened issue');
     $admin = $I->createUser(1, 4);
     $developer1 = $I->createUser(2, 2);
     // developer
     $I->amLoggedAs($admin);
     $project = $I->createProject(1, [$developer1]);
     $I->amOnAction('Project\\IssueController@getNew', ['project' => $project]);
     $issue = $I->createIssue(1, $admin, $developer1, $project);
     $I->amOnAction('Project\\IssueController@getIndex', ['project' => $project, 'issue' => $issue]);
     $I->click(trans('tinyissue.close_issue'), '.close-issue');
     $I->seeLink(trans('tinyissue.reopen_issue'));
     $I->click(trans('tinyissue.reopen_issue'));
     $I->dontSeeLink(trans('tinyissue.reopen_issue'));
     $I->seeLink(trans('tinyissue.close_issue'));
 }