本文整理汇总了PHP中FunctionalTester::expectTo方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTester::expectTo方法的具体用法?PHP FunctionalTester::expectTo怎么用?PHP FunctionalTester::expectTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTester
的用法示例。
在下文中一共展示了FunctionalTester::expectTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPasswordRecoveryRequest
public function testPasswordRecoveryRequest(FunctionalTester $I)
{
// Create one user
$user = Commons::createUser();
$I->expectTo('see the recovery form when going to the recovery page');
$passwordRecoveryRequestPage = PasswordRecoveryRequestPage::openBy($I);
$I->seeElement('#password-recovery-form');
$I->expectTo('see that a proper message is sent when an empty email is set');
$passwordRecoveryRequestPage->submitRecoveryForm('');
$I->seeElement('#password-recovery-form');
$I->see('Email cannot be blank');
$I->expectTo('see that a proper message is sent when a wrong email is set');
$passwordRecoveryRequestPage->submitRecoveryForm('test@fds');
$I->seeElement('#password-recovery-form');
$I->see('Email is not a valid email address.');
$I->expectTo('see that a proper message is sent when an email of unexisting user is set');
$passwordRecoveryRequestPage->submitRecoveryForm('gfds@afgd.bg');
$I->seeElement('#password-recovery-form');
$I->see('There is no user with this email address');
$I->amGoingTo('save the form with correct data');
$passwordRecoveryRequestPage->submitRecoveryForm(Commons::TEST_EMAIL);
$I->expectTo('see the user is redirected to the correct page');
$I->see('Recovery message sent');
$I->expectTo('see that a the token is saved to the database');
$I->seeRecord(Token::className(), ['user_id' => $user->id]);
$I->expectTo('see that a recovery email is sent to the user');
$I->assertNotEmpty($this->mailDir);
}
示例2: submitFormWithIncorrectEmail
public function submitFormWithIncorrectEmail(FunctionalTester $I)
{
$I->submitForm('#contact-form', ['ContactForm[name]' => 'tester', 'ContactForm[email]' => 'tester.email', 'ContactForm[subject]' => 'test subject', 'ContactForm[body]' => 'test content', 'ContactForm[verifyCode]' => 'testme']);
$I->expectTo('see that email address is wrong');
$I->dontSee('Name cannot be blank', '.help-inline');
$I->see('Email is not a valid email address.');
$I->dontSee('Subject cannot be blank', '.help-inline');
$I->dontSee('Body cannot be blank', '.help-inline');
$I->dontSee('The verification code is incorrect', '.help-inline');
}
示例3: 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);
}
示例4: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->expectTo('have a usere in the database');
$I->haveRecord('users', ['username' => 'verem', 'password' => 'danverem', 'email' => 'danverem@gmail.com', 'profile_state' => 0]);
$I->expectTo('have a logged in user');
$user = $I->grabRecord('users', ['username' => 'verem']);
$I->amLoggedAs(['username' => $user->username, 'id' => $user->id, 'password' => $user->password]);
$I->wantTo('test if chops is posting to database');
$I->amOnAction('ChopsController@create');
$I->seeInCurrentUrl('/create');
$I->see('What\'s that special meal you just ate today');
$I->fillField('name', 'edikaikong');
$I->attachFile('image', 'julia.jpeg');
$I->fillField('about', 'This food is the best dish in the country');
$I->click('submitButton');
$I->seeInCurrentUrl('/chops');
示例5: FunctionalTester
<?php
/* @var $scenario Codeception\Scenario */
$I = new FunctionalTester($scenario);
/* TESTING CREATE EMPLOYEE */
$I->wantTo('Memastikan "Create Employee" bekerja');
$I->amOnPage(['employee/create']);
$I->amGoingTo('submit form dengan data input kosong');
$I->click('button[type="submit"]');
$I->expectTo('Validasi eror muncul!');
$I->see('Name cannot be blank.');
$I->see('Age cannot be blank.');
$I->amGoingTo('submit form dengan data');
$I->fillField('input[name="Employee[name]"]', 'Hafid');
$I->fillField('input[name="Employee[age]"]', '30');
$I->click('button[type="submit"]');
$I->expectTo('ada data Hafid di tabel employee');
$I->seeRecord('\\app\\models\\Employee', ['name' => 'Hafid']);
示例6: FunctionalTester
$I = new FunctionalTester($scenario);
$I->am('a CMS admin');
$I->wantTo('create a new section');
// When
$I->amOnPage('admin/sections');
// And
$I->click('Add a new section');
// Then
$I->seeCurrentUrlEquals('/admin/sections/create');
$I->see('New section', 'h1');
$I->amGoingTo('Omit the name field in order to submit an invalid form');
// When
$I->fillField('Slug URL', 'our-company');
$I->click('Create section');
// Then
$I->expectTo('See the form again with the errors');
$I->seeCurrentUrlEquals('/admin/sections/create');
$I->seeInField('slug_url', 'our-company');
$I->see('The name field is required', '.error');
$I->amGoingTo('Fill a valid form');
// When
$I->fillField('Name', 'Our company');
$I->fillField('Slug URL', 'our-company');
$I->selectOption('type', 'blog');
$I->selectOption('menu', 1);
$I->fillField('menu_order', 2);
$I->selectOption('published', 0);
// And
$I->click('Create section');
// Then
$I->seeCurrentUrlEquals('/admin/sections/1');
示例7: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->am('a CMS admin');
$I->wantTo('See section details');
// When
$id = $I->haveSection();
$I->amOnPage('admin/sections/' . $id);
// Then
//$I->seeCurrentUrlEquals('/admin/sections/1');
$I->expectTo('see the section details');
$I->see('Our company', 'h1');
$I->see('our-company', '.slug-url');
$I->see('2', '.menu-order');
$I->see('Show in menu', '.menu');
$I->see('Draft', '.published');
示例8: loginWithWrongCredentials
public function loginWithWrongCredentials(\FunctionalTester $I)
{
$I->submitForm('#login-form', ['LoginForm[username]' => 'admin', 'LoginForm[password]' => 'wrong']);
$I->expectTo('see validations errors');
$I->see('Incorrect username or password.');
}
示例9: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->am('a CMS admin');
$I->wantTo('paginate the sections results');
$I->amGoingTo('Go to page 1');
// When
$sections = $I->haveSections(16);
// And
$I->amOnPage('/admin/sections');
// Then
$I->see('There are 16 sections, showing page 1 of 2');
$I->expectTo('see the first section');
$I->see($sections->first()->name, 'tbody tr:first-child td.name');
$I->expect('not to see the last section');
$I->dontSee($sections->last()->name);
$I->expectTo('see the page 2 link');
$I->see('2', '.pagination a');
$I->amGoingTo('go to page 2');
// When
$I->click('2', '.pagination a');
// Then
$I->expectTo('see the pagination parameter in the URL');
$I->seeCurrentUrlEquals('/admin/sections?page=2');
$I->expect('not to see the first section');
$I->dontSee($sections->first()->name);
$I->expectTo('see the last section');
$I->see($sections->last()->name);
$I->expectTo('See the section #15 as first item on page 2');
$I->see($sections->get(15)->name, 'tbody tr:first-child td.name');
$I->amGoingTo('go back to page 1');
示例10: access_to_the_leading_team_page
public function access_to_the_leading_team_page(FunctionalTester $I)
{
$I->am('Anybody');
$I->wantTo('access to the leading team page');
$I->expectTo('see that the user shown in the category they belong');
/***************************************************************************************************************
* settings
**************************************************************************************************************/
// we create a member of the student leading board
$credentials = ['last_name' => 'Student', 'first_name' => 'President', 'email' => 'student@president.fr', 'status_id' => config('user.status_key.student_president'), 'board_id' => config('user.board_key.student_leading_board'), 'password' => 'test'];
Sentinel::register($credentials, true);
// we create a member of the student leading board
$credentials = ['last_name' => 'Deactivated', 'first_name' => 'Student vice-president', 'email' => 'vice-student@president.fr', 'status_id' => config('user.status_key.user'), 'board_id' => config('user.board_key.student_leading_board'), 'password' => 'test'];
Sentinel::register($credentials);
// we create a member of the leading board
$credentials = ['last_name' => 'Regular', 'first_name' => 'President', 'email' => 'regular@president.fr', 'status_id' => config('user.status_key.president'), 'board_id' => config('user.board_key.leading_board'), 'password' => 'test'];
Sentinel::register($credentials, true);
// we create a member of the executive committee
$credentials = ['last_name' => 'Communication', 'first_name' => 'Responsible', 'email' => 'communication@una-club.fr', 'status_id' => config('user.status_key.communication_commission'), 'board_id' => config('user.board_key.executive_committee'), 'password' => 'test'];
Sentinel::register($credentials, true);
// we create an employee
$credentials = ['last_name' => 'Coach', 'first_name' => 'Employee', 'email' => 'coach@una-club.fr', 'status_id' => config('user.status_key.employee'), 'password' => 'test'];
Sentinel::register($credentials, true);
/***************************************************************************************************************
* run test
**************************************************************************************************************/
$I->amOnPage('/');
$I->seeCurrentRouteIs('home');
$I->click(trans('template.front.header.leading_team'));
$I->see('Student', '.student_leading_board');
$I->see('President', '.student_leading_board');
$I->see(trans('users.config.status.student_president'), '.student_leading_board');
$I->dontSee('Deactivated', '.student_leading_board');
$I->dontSee('Student vice-president', '.student_leading_board');
$I->dontSee(trans('users.config.status.user'), '.student_leading_board');
$I->see('Regular', '.leading_board');
$I->see('President', '.leading_board');
$I->see(trans('users.config.status.president'), '.leading_board');
$I->see('Communication', '.executive_committee');
$I->see('Responsible', '.executive_committee');
$I->see(trans('users.config.status.communication_commission'), '.executive_committee');
$I->see('Coach', '.employee');
$I->see('Employee', '.employee');
$I->see(trans('users.config.status.employee'), '.employee');
}
示例11: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('register a user from index page');
$I->expectTo('have a users in the database');
$I->amOnPage('/');
$I->haveRecord('users', ['email' => 'andela@andela.com', 'username' => 'andelabendozy', 'password' => bcrypt('password'), 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'status' => TRUE, 'profile_state' => FALSE]);
$I->submitForm('form#register', ['name' => 'prosper', 'email' => 'andela11@andela.com', 'password' => '12345678', 'password_confirmation' => '12345678']);
$I->seeAuthentication();
$I->seeCurrentUrlEquals('');
$I->seeRecord('users', ['email' => 'andela@andela.com']);
$I->seeAuthentication();
$I->wantTo('logout');
$I->logout();
$I->dontSeeAuthentication();
示例12: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->am('a CMS admin');
$I->wantTo('filter and paginate the section list');
// When
$sections = $I->haveSections(90);
// Random sections
// And
$I->amOnPage('admin/sections');
$I->selectOption('published', '1');
$I->click('Filter sections');
$I->click('2', '.pagination a');
// Then
$I->expectTo('see published sections');
$I->see('Published', 'td');
$I->expect('not to see draft sections');
$I->dontSee('Draft', 'td');
示例13: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('test if chops can be displayed on the home page after posting');
$I->expectTo('have a registered user in the database');
$user_id = $I->haveRecord('users', ['username' => 'John Doe', 'password' => 'johndope', 'email' => 'john@doe.com', 'profile_state' => 0]);
$I->expectTo('have a chops record in the database');
$I->haveRecord('chops', ['chops_name' => 'A new name', 'about' => 'About this chops', 'user_id' => $user_id, 'likes' => 0]);
$I->expectTo('have the action take place in the controller');
$I->amOnAction('ChopsController@index');
$I->seeInCurrentUrl('/chops');
$I->see('About this chops');
$I->see('A new name');
示例14: activate_account_from_email
public function activate_account_from_email(FunctionalTester $I)
{
$I->am('Unlogged user with a not activated account');
$I->wantTo('activate my account');
$I->expectTo('see a success confirmation message explaining that my account is activated');
/***************************************************************************************************************
* settings
**************************************************************************************************************/
// we create a user
$this->_credentials = ['last_name' => 'NOM', 'first_name' => 'Prénom', 'email' => 'autre@test.fr', 'password' => 'password'];
$user = \Sentinel::register($this->_credentials);
// we create an activation
$activation = \Activation::create($user);
/***************************************************************************************************************
* run test
**************************************************************************************************************/
$I->sendAjaxRequest('GET', route('account.activate', ['email' => $user->email, 'token' => $activation->code]));
$I->see(trans('global.modal.alert.title.success'));
$I->see(strip_tags(trans('auth.message.activation.success', ['name' => $user->first_name . ' ' . $user->last_name])));
}
示例15: FunctionalTester
<?php
$I = new FunctionalTester($scenario);
$I->wantTo('check application versioning');
$I->dontSeeFileFound('src/version');
$I->seeFileFound('version');
$I->openFile('version');
$I->dontSeeInThisFile('dev');
$I->dontSeeInThisFile('dirty');
$version = file_get_contents('version');
$I->amGoingTo('check version visiblity in modal');
$I->expectTo('see application version ' . $version);
$I->amOnPage('/user/security/login');
$I->see($version, '.modal-body');