Пример #1
0
 /**
  * @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);
 }