I'm new to laravel. I am trying to test that authentication works for my website and I want to test the authentication process in a test case. I create a in-memory sqlite database, I create a new User and use ->save() method of eloquent to store it in the database. I have setup an authentication filter which checks for the username in the database and depending on that it either allows the user to login or returns "invalid credentials"

// my UserTest.php file :

class UserTest extends TestCase {

public function testUsernameIsNotRequired()
{
    // Create a new User
    $user = new User;
    $user->username = "phil@ipbrown.com";
    $user->password = "123456";
    //$user->password_confirmation = "password";

    // User should save
    $this->assertTrue($user->save());

    // Save the errors
    $password = $user->getAuthPassword();

    // There should be 0 error
    $this->assertEquals("123456",$password);
    $this->seed();

    $this->be($user);

    $this->assertTrue(Redirect::route('authFilter'));
}
}

just to let you know that the in-memory db is lost once the test is complete as all the connections to it are lost so I want to check that the user that I saved to my db is properly inserted and second I want to check if I can login to my website using the information of this new user.

// my filters.php file :

Route::filter('auth', function()
{
    if (Auth::guest()) return Redirect::guest('login');
});


Route::filter('auth.basic', function()
{
    return Auth::basic('username');
});

Route::filter('guest', function()
{
    if (Auth::check()) return Redirect::to('/');
});

Route::filter('csrf', function()
{
    if (Session::token() != Input::get('_token'))
    {
        throw new Illuminate\Session\TokenMismatchException;
    }
});

I was trying to attach a filter to a route so that I can redirect to the route during my test and

Edit
Report