php - Larabook Auth::check() not working -
hi guys have problem codeception,
isn't working correctly , i'm using same code
there videos larabook scratch
code in signupcept.php
$i = new functionaltester($scenario); $i->am('a guest'); $i->wantto('sign larabook account'); $i->amonpage('/'); $i->click('sign up!'); $i->seecurrenturlequals('/register'); $i->fillfield('username:', 'johndoe'); $i->fillfield('email:', 'john@example.com'); $i->fillfield('password:', 'demo'); $i->fillfield('password confirmation:', 'demo'); $i->click('sign up'); $i->seecurrenturlequals(''); $i->see('welcome larabook!'); $i->seerecord('users',[ 'username' => 'johndoe', 'email' => 'john@example.com', 'password' => 'demo' ]); $i->asserttrue(auth::check());
this registrationcontroller.php
class registrationcontroller extends \basecontroller { /** * show form register user. * * @return response */ public function create() { return view::make('registration.create'); } /** * creating new larbook user. * * @return response */ public function store() { $user = user::create( input::only('username', 'email', 'password') ); auth::login($user); return redirect::home(); } }
and error i'm getting
functional tests (1) ---------------------------------------------------------------------------------------- sign larabook account (signupcept) fail ------------------------------------------------------------------------------------------------------------- time: 6.04 seconds, memory: 25.50mb there 1 failure: --------- 1) failed sign larabook account in signupcept (tests/functional/signupcept.php) step assert true false fail failed asserting false true. scenario steps: 13. $i->asserttrue(false) @ tests/functional/signupcept.php:28 12. $i->seerecord("users",{"username":"johndoe","email":"john@example.com","password":"demo"}) @ tests/functional/signupcept.php:26 11. $i->see("welcome larabook!") @ tests/functional/signupcept.php:20 10. $i->seecurrenturlequals("") @ tests/functional/signupcept.php:19 9. $i->click("sign up") @ tests/functional/signupcept.php:17 8. $i->fillfield("password confirmation:","demo") @ tests/functional/signupcept.php:15 failures! tests: 1, assertions: 4, failures: 1.
you can't use auth::check()
, keep in mind here have two instances, 1 codeception , other application being tested.
this means trying auth::check()
codeception instance, useless you.
you must rely on laravel5 module , use seeauthentication()
replicate intent.
Comments
Post a Comment