本文整理汇总了PHP中FunctionalTester::wantTo方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::wantTo方法的具体用法?PHP FunctionalTester::wantTo怎么用?PHP FunctionalTester::wantTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::wantTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkAuthEndpoint
public function checkAuthEndpoint(FunctionalTester $I)
{
$I->wantTo('Visit login endpoint');
$I->amOnPage('login');
$I->seeResponseCodeIs(200);
$I->wantTo('Visit register endpoint');
$I->amOnPage('register');
$I->seeResponseCodeIs(200);
}
示例2: testValidDetails
public function testValidDetails(\FunctionalTester $I)
{
$I->wantTo('test logging in with the correct details');
LoginPage::openBy($I);
LoginPage::loginAsUser($I);
$I->seeCurrentUrlEquals(IndexPage::$url);
}
示例3: testUserRegistration
/**
*
* @param \FunctionalTester $I
* @param \Codeception\Scenario $scenario
*/
public function testUserRegistration($I, $scenario)
{
$I->wantTo('ensure that registration works');
$registrationPage = RegistrationPage::openBy($I);
$I->see('Sign up', 'h1');
$I->amGoingTo('submit registration form with no data');
$registrationPage->submit([]);
$I->expectTo('see validations errors');
$I->see('Username cannot be blank.', '.help-block');
$I->see('E-mail cannot be blank.', '.help-block');
$I->see('Password cannot be blank.', '.help-block');
$I->see('Repeated password cannot be blank.', '.help-block');
$I->amGoingTo('submit registration form with not correct email and repeated password');
$registrationPage->submit(['username' => 'tester', 'email' => 'tester.email', 'password' => 'tester_password', 'password2' => 'tester_password2']);
$I->expectTo('see that email address and repeated password is wrong');
$I->dontSee('Username cannot be blank.', '.help-block');
$I->dontSee('Password cannot be blank.', '.help-block');
$I->dontSee('Repeated password cannot be blank.', '.help-block');
$I->see('E-mail is not a valid email address.', '.help-block');
$I->see('Repeated password must be repeated exactly.', '.help-block');
$I->amGoingTo('submit registration form with correct data');
$registrationPage->submit(['username' => 'tester', 'email' => 'tester.email@example.com', 'password' => 'tester_password', 'password2' => 'tester_password']);
$registrationPage = RegistrationPage::openBy($I);
$I->amGoingTo('submit registration form with same data');
$registrationPage->submit(['username' => 'tester', 'email' => 'tester.email@example.com', 'password' => 'tester_password', 'password2' => 'tester_password']);
$I->expectTo('see that username and email address have already been taken');
$I->see('Username "tester" has already been taken.', '.help-block');
$I->see('E-mail "tester.email@example.com" has already been taken.', '.help-block');
// $I->expectTo('see that user logged in');
// $I->seeLink('Logout (tester)');
}
示例4: testPageContent
public function testPageContent(\FunctionalTester $I)
{
$I->wantTo('test that the project creation page works');
CreatePage::openBy($I, $this->params);
$I->see(CreatePage::$headingText, CreatePage::$headingSelector);
$I->see(CreatePage::$placeholderText);
}
示例5: guestCantVisitRolesPage
public function guestCantVisitRolesPage(FunctionalTester $I)
{
$I->am('a guest');
$I->wantTo('make sure I can\'t view the roles page');
//I can see the menu item
$I->amOnPage('/roles');
$I->canSeeCurrentUrlEquals('/login');
}
示例6: testUnApprovedUser
public function testUnApprovedUser(FunctionalTester $I)
{
$I->wantTo('ensure that unapproved user cannot login');
$loginPage = LoginPage::openBy($I);
$loginPage->login('UnApprovedUser', '123qwe');
$I->expectTo('see validations errors');
$I->see('Your account is not approved yet!');
}
示例7: it_should_insert_a_user_in_the_database_allowing_for_user_defaults_override
/**
* @test
* it should insert a user in the database allowing for user defaults override
*/
public function it_should_insert_a_user_in_the_database_allowing_for_user_defaults_override(FunctionalTester $I)
{
$I->wantTo('insert a user in the database overriding defaults');
$table = $I->grabPrefixedTableNameFor('users');
$overrides = ['user_pass' => 'luca12345678', 'user_nicename' => 'lucatume', 'user_email' => 'luca@theaveragedev.com', 'user_url' => 'http://theaveragedev.com', 'user_status' => 1, 'user_activation_key' => 'foo', 'display_name' => 'theAverageDev'];
$I->haveUserInDatabase('Luca', 'subscriber', $overrides);
$I->seeUserInDatabase($overrides);
}
示例8: testValidPassword
public function testValidPassword(\FunctionalTester $I)
{
$I->wantTo('test that supplying valid new password succeeds');
ResetPasswordPage::setNewPassword($I, Auth::$newPassword);
$I->seeCurrentUrlEquals(IndexPage::$url);
$I->see('Your new password has been saved.');
$hash = $I->grabRecord('app\\models\\User', ['email' => Auth::$validEmail])->passwordHash;
$I->assertTrue(Yii::$app->getSecurity()->validatePassword(Auth::$newPassword, $hash));
}
示例9: updateItem
public function updateItem(FunctionalTester $I, $scenario)
{
$I->wantTo('modify an existing item');
$I->sendPUT('/vehicles/123', ['name' => 'Pansy updated']);
$scenario->incomplete('work in progress');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(['id' => 123, 'name' => 'Pansy updated']);
}
示例10: GetTimestamp
public function GetTimestamp(Tester $I)
{
$I->wantTo('Get Current Server Timestamp, make sure it is smaller than local');
$I->haveHttpHeader("apikey", $this->apiInfo[Helper::CSV_ORDER_APIKEY]);
$I->sendGET("currenttime", ["source" => $this->apiInfo[Helper::CSV_ORDER_SOURCE]]);
$response = $I->grabResponse();
$timeDifference = time() - intval($response);
$I->assertTrue($timeDifference < 90 && $timeDifference > -90);
}
示例11: testRegisterSuccsess
public function testRegisterSuccsess(FunctionalTester $I)
{
$I->wantTo('register a user');
$I->amOnPage('/register');
$I->fillField('name', 'JohnDoe');
$I->fillField('email', 'johnDoe@gmail.com');
$I->fillField('password', 'admin');
$I->fillField('password_confirmation', 'admin');
$I->click('Continue');
$I->amOnPage('/');
}
示例12: invalidUsernamePassword
/**
* @param FunctionalTester $I
*
* @return void
*/
public function invalidUsernamePassword(FunctionalTester $I)
{
$I->wantTo('login with invalid username/password');
$I->amOnAction('HomeController@getIndex');
$I->dontSeeAuthentication();
$I->see('Login');
$I->fillField('Email', 'user@user.com');
$I->fillField('Password', '1234');
$I->click('Login');
$I->dontSeeAuthentication();
}
示例13: trySigninWithInvalidCredentials
public function trySigninWithInvalidCredentials(FunctionalTester $I)
{
$I->wantTo('Login as user with invalid credentials');
$I->dontSeeAuthentication();
$I->amOnPage('/login');
$I->fillField('identifier', 'spectator');
$I->fillField('password', 'invalid');
$I->click('button[type=submit]');
$I->seeCurrentUrlEquals('/login');
$I->dontSeeAuthentication();
}
示例14: testVolunteerFormLinkWithLogin
public function testVolunteerFormLinkWithLogin(\FunctionalTester $I)
{
$I->wantTo('check that logging in after trying to access the volunteer form redirects me to the volunteer form');
IndexPage::openBy($I);
$I->click(IndexPage::$volunteerFormButtonText, IndexPage::$contentSelector);
$I->seeCurrentUrlEquals(LoginPage::$url);
LoginPage::loginAsUser($I);
$I->seeCurrentUrlEquals(VolunteerPage::$url);
$I->seeLink(VolunteerPage::$logoutLinkText);
$I->see(VolunteerPage::$headingText, VolunteerPage::$headingSelector);
}
示例15: testValidDetails
public function testValidDetails(\FunctionalTester $I)
{
$page = $this->page;
$activity = $this->activity;
$I->wantTo('test that submitting valid data is successful');
$page::openBy($I, $this->params);
$page::submit($I, ['project' => $activity::$project, 'name' => $activity::$name, 'date' => $activity::$date, 'description' => $activity::$description]);
$I->seeCurrentUrlEquals(IndexPage::$url);
$I->see($activity::$name);
$I->seeRecord('app\\models\\ProjectActivity', ['projectID' => $activity::$project, 'name' => $activity::$name, 'date' => $activity::$date, 'description' => $activity::$description]);
}