本文整理汇总了PHP中FunctionalTester::createUser方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::createUser方法的具体用法?PHP FunctionalTester::createUser怎么用?PHP FunctionalTester::createUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::createUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _createData
/**
* @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];
}
示例2: deleteUser
/**
* @param FunctionalTester $I
*
* @actor FunctionalTester
*
* @return void
*/
public function deleteUser(FunctionalTester $I)
{
$I->am('Admin User');
$I->wantTo('delete an existing user details');
$admin = $I->createUser(1, 4);
$user = $I->createUser(2, 1);
$user1 = $I->createUser(3, 2);
$I->amLoggedAs($admin);
$I->amOnAction('Administration\\UsersController@getDelete', ['user' => $user]);
$I->seeCurrentActionIs('Administration\\UsersController@getIndex');
$I->dontSee($user->fullname);
$I->see($user1->fullname);
}
示例3: assignToUser
/**
* @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');
}
示例4: viewInvalidNote
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);
}
示例5: deleteProject
/**
* @param FunctionalTester $I
*
* @actor FunctionalTester
*
* @return void
*/
public function deleteProject(FunctionalTester $I)
{
$I->am('Admin User');
$I->wantTo('delete an existing project details');
$project = $I->createProject(1);
$admin = $I->createUser(1, 4);
$I->amLoggedAs($admin);
$I->amOnAction('ProjectController@getEdit', ['project' => $project]);
$I->click(trans('tinyissue.delete_something', ['name' => $project->name]));
$I->seeCurrentActionIs('ProjectsController@getIndex');
$I->dontSeeLink('Project 1');
$I->amOnAction('ProjectsController@getIndex', ['status' => Project::STATUS_ARCHIVED]);
$I->dontSeeLink('Project 1');
$I->dontSeeRecord($project->getTable(), ['name' => 'Project 1']);
}
示例6: updateTag
/**
* @param FunctionalTester $I
*
* @actor FunctionalTester
*
* @return void
*/
public function updateTag(FunctionalTester $I)
{
$I->am('Admin User');
$I->wantTo('edit an existing tag');
$tag = (new Tag())->where('group', '=', false)->get()->random(1);
$data = ['name' => 'tag updated'];
$tagName = $tag->name;
$I->amLoggedAs($I->createUser(1, 4));
$I->amOnAction('Administration\\TagsController@getIndex');
$I->click($this->_editTagSelector($tagName));
$I->seeCurrentActionIs('Administration\\TagsController@getEdit', ['tag' => $tag]);
$I->submitForm('form', $data);
$I->amOnAction('Administration\\TagsController@getIndex');
$I->see($data['name'], $this->_editTagSelector($data['name']));
$I->dontSee($data['name'], $this->_editTagSelector($tagName));
}
示例7: deleteNote
/**
* @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 . '"]');
}
示例8: deleteComment
/**
* @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);
}
示例9: viewOverview
/**
* @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');
}
示例10: cantCreateUser
/**
* @param \FunctionalTester $I
*
* @actor FunctionalTester
*
* @return void
*/
public function cantCreateUser(FunctionalTester $I)
{
$I->am('Manager User');
$I->expectTo('not be able to create new user');
$I->amLoggedAs($I->createUser(1, 3));
$I->amOnAction('Administration\\UsersController@getAdd');
$I->seeResponseCodeIs(401);
}
示例11: removeUserFromProject
/**
* @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);
}
示例12: _cantAccessPage
/**
* @param FunctionalTester $I
* @param string|array $action
* @param string $expectTo
*
* @return void
*/
protected function _cantAccessPage(FunctionalTester $I, $action, $expectTo)
{
$action = is_array($action) ? $action : [$action];
$I->am('Developer User');
$I->expectTo('not be able to ' . $expectTo);
$I->amLoggedAs($I->createUser(1, 2));
call_user_func_array([$I, 'amOnAction'], $action);
$I->seeResponseCodeIs(401);
}
示例13: viewIssues
/**
* @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);
}
示例14: removeAttachment
/**
* @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);
}
示例15: closeIssue
/**
* @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'));
}