mercredi 21 septembre 2016

Testing in Laravel without passing through auth

I'm trying create a test in Laravel 5.1 but I want to use it without the authorization form.

In my RoleController class I put this in order to :

public function __construct()
{
    $this->middleware('auth');
}

I've tried using use WithoutMiddleWare; but did'nt work. This is the phpunit output:

A request to [http://localhost/nuevo/rol] failed. Received status code [500].

Also tried using $this->withoutMiddleware(); for each test method but that din't work either. This is the phpunit output:

InvalidArgumentException: Nothing matched the filter [nombre] CSS query provided for [http://localhost/auth/login].

Instead of visit the "nuevo/rol" route the test make a request to "auth/login" as it works using the auth form.

Is there a method to test without using the authorization form or I need to put in my test code the logic to use it?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire