Laravel - HTTP Tests - Assert Session Has

Assert that the session contains the given piece of data:

    
    $response->assertSessionHas($key, $value = null);
	

If needed, a closure can be provided as the second argument to the assertSessionHas method. The assertion will pass if the closure returns true:

    
    $response->assertSessionHas($key, function ($value) {
        return $value->name === 'Taylor Otwell';
    });