Sorry about that, should have added the code. Let me know if this is not enough to clarify
public function store()
{
//fetch the form input
$formData = Input::only('email', 'password');
// validate the form
$this->signInForm->validate($formData);
// invalid then go back
if(Auth::attempt([
'email' => Input::get('email'),
'password' => Input::get('password'),
'confirmed' => 1 // make sure the user has been email verified
]))
{/*
if(Agent::isMobile())
{
}
*/
Flash::message('Welcome back!');
return Redirect::intended('/statuses');
}else
{
Flash::message('Please make sure you verified your email registration and email and password are filled in accurately');
return Redirect::back();
}
}
codecept file is
<?php
$I = new FunctionalTester($scenario);
$I->am('member');
$I->wantTo('login to my account');
//$I->amNotMobile();
$I->logIn(); // look in FunctionHelper.php for definition of method
$I->seeInCurrentUrl('/statuses');
$I->see('Welcome back!');
$I->assertTrue(Auth::check());
function helper file
<?php
namespace Codeception\Module;
use Laracasts\TestDummy\Factory as TestDummy;
use Jenssegers\Agent\Facades\Agent;
class FunctionalHelper extends \Codeception\Module
{
public function logIn()
{
$email = 'foo@example.com';
$password = 'foo';
$this->haveAnAccount(compact('email', 'password'));
$I = $this->getModule('Laravel4');
$I->amOnPage('/login');
$I->fillField('email',$email );
$I->fillField('password',$password);
$I->click('Log In');
}
public function haveAnAccount($overrides = [])
{
TestDummy::create('MyApp\Users\User', $overrides);
}
public function amNotMobile()
{
! Agent::isMobile();
}
}
I am also not sure how I will test Flash:: message and the Agent is Mobile not commented out
Appreciate your help
Thx
PS a more indepth tutorial on codeception would be great -- again thx