<?php $I = new FunctionalTester($scenario); $I->am('a Larabook member'); $I->wantTo('Login to my Larabook account'); $I->signIn(); $I->seeInCurrentUrl('/statuses'); $I->see('Welcome back!'); $I->assertTrue(Auth::check());
<?php $I = new FunctionalTester($scenario); $I->am('a Larabook member'); $I->wantTo('I want to view my profile'); $I->signIn(); $I->postAStatus('My new status.'); $I->click('Your profile'); $I->seeInCurrentUrl('/@Foobar'); $I->see('My new status.');
<?php /** * @var \Codeception\Scenario $scenario */ $I = new FunctionalTester($scenario); $I->wantTo('login as regular user'); $I->amOnPage('/'); $I->click('Log In/Sign Up'); $I->seeInCurrentUrl('/session/index'); $I->see('Log In', "//*[@id='login-header']"); $I->see("Don't have an account yet?", "//*[@id='signup-header']"); $I->fillField('email', '*****@*****.**'); $I->fillField('password', 'phalcon'); $I->click('Login'); $I->seeInCurrentUrl('/session/start'); $I->see('Welcome Phalcon Demo'); $I->seeLink('Log Out');
<?php $I = new FunctionalTester($scenario); $I->am("a Larabook member"); $I->wantTo("login to my Larabook account"); $I->signIn(); $I->seeInCurrentUrl("/statuses"); $I->see("Welcome back!"); $I->assertTrue(Auth::check());
<?php $I = new FunctionalTester($scenario); $I->expectTo('have a usere in the database'); $I->haveRecord('users', ['username' => 'verem', 'password' => 'danverem', 'email' => '*****@*****.**', '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');
<?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' => '*****@*****.**', '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');
<?php /** * @var \Codeception\Scenario $scenario */ $I = new FunctionalTester($scenario); $I->wantTo('logout from site'); $I->haveInSession('auth', ['id' => 1, 'name' => 'Phalcon Demo']); $I->amOnPage('/'); $I->click('Log Out'); $I->see('Goodbye Phalcon Demo!'); $I->seeInCurrentUrl('/session/end');
<?php /** * @var \Codeception\Scenario $scenario */ $I = new FunctionalTester($scenario); $I->wantTo('open invoices page and see invoices there'); $I->haveInSession('auth', ['id' => 1, 'name' => 'Phalcon Demo']); $I->amOnPage('/'); $I->click('Invoices'); $I->seeInCurrentUrl('/invoices/index'); $I->see('Your Invoices');
<?php $I = new FunctionalTester($scenario); $I->wantTo('login as a user from index page with invalid details'); $I->expectTo('fail to login'); $I->amOnPage('/'); $I->submitForm('form#login', ['email' => 'andelabendo', 'password' => 'password']); $I->seeInCurrentUrl('/login'); $I->dontSeeAuthentication(); $I->seeFormHasErrors(); $I->see('These credentials do not match our records.'); $I->wantTo('login as a user from index page with correct details'); $I->expectTo('have a users in the database'); $I->amOnPage('/'); $I->haveRecord('users', ['email' => '*****@*****.**', 'username' => 'andelabendozy', 'password' => bcrypt('password'), 'created_at' => new DateTime(), 'updated_at' => new DateTime(), 'status' => TRUE, 'profile_state' => FALSE]); $I->submitForm('form#login', ['email' => 'andelabendozy', 'password' => 'password']); $I->seeCurrentUrlEquals(''); $I->amOnPage('/'); $I->seeAuthentication(); $I->wantTo('logout'); $I->logout(); $I->dontSeeAuthentication();
<?php $I = new FunctionalTester($scenario); $I->am('a BCD Online Forms website member'); $I->wantTo('login to BCD Online Forms account'); $I->signIn(); $I->seeInCurrentUrl('/dashboard'); $I->see('Dashboard');