I am writing a test for an update method on the controller. When I run phpunit the test never reaches the controller, it just redirects it. When I add ->dump() this is what I get:
<!DOCTYPE html>\n
<html>\n
<head>\n
<meta charset="UTF-8" />\n
<meta http-equiv="refresh" content="1;url=http://ptr.dev" />\n
\n
<title>Redirecting to http://ptr.dev</title>\n
</head>\n
<body>\n
Redirecting to <a href="http://ptr.dev">http://ptr.dev</a>.\n
</body>\n
</html>
Middleware is enabled as some of it is required to access app. If I trigger some of the middleware it will change the Redirect to part of the code above. Only problem is none of my middleware directs back to the address listed. Here is code in test:
public function test_client_is_updated()
{
Session::start();
$plan = factory(App\Plan::class)->create();
$hospital = factory(App\Hospital::class)->create([
'hospitalPhone' => '3104445555',
'mobilePhone' => '+15005550006',
'plan_id' => $plan->id,
'stripe_active' => 1
]);
$user = factory(App\User::class)->create([
'hospital_id' => $hospital->id,
]);
$client = factory(App\Client::class)->create([
'hospital_id' => $hospital->id
]);
$url = 'hospital/' . $hospital->id . '/client/' . $client->id;
$new_client_info = [
'_token' => csrf_token(),
'phone1' => '13105556699'
];
$this->actingAs($user)
->patch($url, $new_client_info)
->dump()
->seeInDatabase('clients', ['id' => $client->id, 'phone1' => $new_client_info['phone1']]);
}