samedi 19 mai 2018

How to make a HTTP request behalf another session in a Laravel test?

When I perform HTTP tests in Laravel 5 using built-in tools, the framework remembers the session data from request to request.

class HttpTest extends TestCase
{
    public function testApplication()
    {
        // Suppose this endpoint creates a session and adds some data to it
        $this->get('/action/fillSession');

        // Suppose this endpoint reads the session data
        $this->get('/action/readSession'); // The session data from the first request is available here
    }
}

How to make a single request with another session without destroying the original first session?

Aucun commentaire:

Enregistrer un commentaire