本文整理汇总了PHP中FunctionalTester类的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester类的具体用法?PHP FunctionalTester怎么用?PHP FunctionalTester使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FunctionalTester类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: should_correctly_route_to_index
/** @test */
public function should_correctly_route_to_index(FunctionalTester $I)
{
// given .. I am on index page
$I->amOnPage('/');
// then ... I should see correct route
$I->seeCurrentUrlEquals('/');
}
示例2: testChangePassword
public function testChangePassword(FunctionalTester $I)
{
$I->amGoingTo('test the change password functionality');
// Create one user
$user = Commons::createUser();
$I->amGoingTo('login a user');
$loginPage = LoginPage::openBy($I);
$loginPage->login(Commons::TEST_EMAIL, Commons::TEST_PASSWORD);
$changePasswordPage = ChangePasswordPage::openBy($I);
$I->see('Change password');
$I->seeElement('#changepasswordform-newpassword');
$I->seeElement('#changepasswordform-newpasswordrepeat');
$I->dontSeeElement('#changepasswordform-email');
$I->dontSeeElement('#changepasswordform-oldpassword');
$I->amGoingTo('try to change the password with two different passwords for the new password and the new password repeat fields');
$changePasswordPage->changePassword('123123', '234234');
$I->expect('the form will catch the difference');
$I->see('The new passwords are not the same.');
$I->amGoingTo('test adding new password with length lower than the default length');
$changePasswordPage->changePassword('123', '123');
$I->expect('the form will warn the user');
$I->see('New password should contain at least 6 characters');
$I->see('New password repeat should contain at least 6 characters');
$I->amGoingTo('change the password of the user properly');
$changePasswordPage->changePassword('Nik)lay!23', 'Nik)lay!23');
$I->expect('that this time everything will be ok and the user will be redirected to the home page');
$user->refresh();
$I->assertNotNull($user->password_changed_at);
$I->seeInCurrentUrl('/');
}
示例3: seeContact
/**
* @param FunctionalTester $I
*/
public function seeContact(FunctionalTester $I)
{
$I->wantToTest('if I can see the contact form as anonymous user');
$I->amOnPage('/');
$I->click(['link' => 'Contact']);
$I->see('ContactForm');
}
示例4: 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)');
}
示例5: 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);
}
示例6: submitFormSuccessfully
public function submitFormSuccessfully(\FunctionalTester $I)
{
$I->submitForm('#contact-form', ['ContactForm[name]' => 'tester', 'ContactForm[email]' => 'tester@example.com', 'ContactForm[subject]' => 'test subject', 'ContactForm[body]' => 'test content', 'ContactForm[verifyCode]' => 'testme']);
$I->seeEmailIsSent();
$I->dontSeeElement('#contact-form');
$I->see('Thank you for contacting us. We will respond to you as soon as possible.');
}
示例7: checkCorrectChangePassword
public function checkCorrectChangePassword(FunctionalTester $I)
{
$I->submitForm('#login-form', $this->loginFormParams('test-user@example.com', '123123'));
$I->click('My Account');
$I->submitForm('#change-password-form', $this->resetPasswordFormParams('123456', '123456'));
$I->see('Password has been updated.');
}
示例8: 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);
}
示例9: it_should_allow_not_having_a_link_in_the_database
/**
* @test
* it should allow not having a link in the database
*/
public function it_should_allow_not_having_a_link_in_the_database(FunctionalTester $I)
{
$id = $I->haveLinkInDatabase();
$I->seeLinkInDatabase(['link_id' => $id]);
$I->dontHaveLinkInDatabase(['link_id' => $id]);
$I->dontSeeLinkInDatabase(['link_id' => $id]);
}
示例10: checkValidLogin
public function checkValidLogin(FunctionalTester $I)
{
$I->submitForm('#login-form', $this->formParams('admin@example.org', '123123'));
$I->see('Logout (admin)', 'form button[type=submit]');
$I->dontSeeLink('Login');
$I->dontSeeLink('Signup');
}
示例11: getNoErrorWithTwigUnknownsIfIgnoring
public function getNoErrorWithTwigUnknownsIfIgnoring(FunctionalTester $I)
{
$I->bootKernelWith('unknowns_suppress');
$I->runCommand('maba_webpack.command.setup');
$I->runCommand('maba_webpack.command.compile');
$I->seeCommandStatusCode(0);
}
示例12: deleteMyRedirect
public function deleteMyRedirect(FunctionalTester $I)
{
$I->haveRecord('links', $this->linkRecord);
LinksPage::of($I)->deleteLink();
$I->dontSeeRecord('links', $this->linkRecord);
$I->seeCurrentUrlEquals(LinksPage::$URL);
$I->dontSee('/' . $this->link['uri']);
}
示例13: 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');
}
示例14: 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!');
}
示例15: dontSeeVisualChanges
/**
* @param FunctionalTester $I
*/
public function dontSeeVisualChanges(FunctionalTester $I)
{
$I->amOnPage('/');
$I->dontSeeVisualChanges('same');
// the test has to be called twice for comparison on the travis server
$I->amOnPage('/');
$I->dontSeeVisualChanges('same');
}