/**
  * @param FunctionalTester $I
  * @param Project          $project
  * @param array            $params
  *
  * @return void
  */
 protected function _exportIssues(FunctionalTester $I, Project $project, array $params)
 {
     $I->amOnAction('ProjectController@getIndex', ['project' => $project]);
     $uri = $I->getApplication()->url->action('ProjectController@postExportIssues', ['project' => $project]);
     $I->sendAjaxPostRequest($uri, array_merge(['_token' => csrf_token(), 'keyword' => '', 'assignto' => '', 'tags' => ''], $params));
     $I->seeResponseCodeIs(200);
 }
예제 #2
0
 public function viewInvalidNote(FunctionalTester $I)
 {
     $I->am('Normal User');
     $I->expectTo('see 401 error with mismatch note route parameters.');
     $admin = $I->createUser(1, 4);
     // admin
     $project1 = $I->createProject(1, [$admin]);
     $project2 = $I->createProject(2, [$admin]);
     $note1 = $I->createNote(1, $admin, $project1);
     $I->amLoggedAs($admin);
     $I->amOnAction('ProjectController@getNotes', ['project' => $project1]);
     $uri = $I->getApplication()->url->action('ProjectController@postEditNote', ['project' => $project2, 'note' => $note1], false);
     $I->sendAjaxPostRequest($uri, ['body' => 'note one updated', '_token' => csrf_token()]);
     $I->seeResponseCodeIs(401);
 }
예제 #3
0
 /**
  * @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);
 }
예제 #4
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function removeUserFromProject(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('not be able to remove user to a project');
     $admin = $I->createUser(1, 4);
     $developer1 = $I->createUser(2, 2);
     // developer
     $I->amLoggedAs($admin);
     $project = $I->createProject(1, [$developer1]);
     $I->amOnAction('ProjectController@getIndex', ['project' => $project]);
     $I->see($developer1->fullname, '#project-user' . $developer1->id);
     $uri = $I->getApplication()->url->action('ProjectController@postUnassign', ['project' => $project]);
     $I->sendAjaxPostRequest($uri, ['user_id' => $developer1->id, '_token' => csrf_token()]);
     $I->seeResponseCodeIs(200);
     $I->amOnAction('ProjectController@getIndex', ['project' => $project]);
     $I->dontSee($developer1->fullname, '#project-user' . $developer1->id);
 }
예제 #5
0
 /**
  * @param FunctionalTester $I
  *
  * @actor FunctionalTester
  *
  * @return void
  */
 public function deleteNote(FunctionalTester $I)
 {
     $I->am('Admin User');
     $I->wantTo('delete an existing note from a project');
     $admin = $I->createUser(1, 4);
     $I->amLoggedAs($admin);
     $project = $I->createProject(1);
     $note1 = $I->createNote(1, $admin, $project);
     $note2 = $I->createNote(2, $admin, $project);
     $I->amOnAction('ProjectController@getNotes', ['project' => $project]);
     $I->see('Note 1', '//li[@id="note' . $note1->id . '"]');
     $I->see('Note 2', '//li[@id="note' . $note2->id . '"]');
     $uri = $I->getApplication()->url->action('ProjectController@getDeleteNote', ['project' => $project, 'note' => $note2]);
     $I->sendAjaxGetRequest($uri);
     $I->seeResponseCodeIs(200);
     $I->amOnAction('ProjectController@getNotes', ['project' => $project]);
     $I->see('Note 1', '//li[@id="note' . $note1->id . '"]');
     $I->dontSee('Note 2', '//li[@id="note' . $note2->id . '"]');
 }
예제 #6
0
 public function _before(FunctionalTester $I)
 {
     $this->app = $I->getApplication();
     $this->app->register('Inoplate\\Account\\Providers\\AccountServiceProvider');
 }
예제 #7
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');
 }
예제 #8
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);
 }