In your case, you can simply assert that the view returned by the route has routedata.
public function testIndex()
{
$this->call('GET', '/path/to/my/controlller/method');
$this->assertViewHas('routedata');
$this->assertViewHas('client');
$this->assertViewHas('clientProfile');
}
However, you could take this one step further and you could make assertions about the type of data that was sent to the view.
First, grab the data:
$routedata = $response->original->getData()['routedata'];
$client = $response->original->getData()['client'];
$clientProfile = $response->original->getData()['clientProfile '];
Now you can test the instances
of these variables to ensure they were properly set as well:
$this->assertInstanceOf('\Illuminate\Database\Eloquent\Collection', $routedata);
$this->assertInstanceOf('\App\Client', $client);
$this->assertInstanceOf('\App\ClientProfile', $clientProfile);
All together it would be something like:
public function testIndex()
{
$this->call('GET', '/path/to/my/controlller/method');
$this->assertViewHas('routedata');
$this->assertViewHas('client');
$this->assertViewHas('clientProfile');
$routedata = $response->original->getData()['routedata'];
$client = $response->original->getData()['client'];
$clientProfile = $response->original->getData()['clientProfile '];
$this->assertInstanceOf('\Illuminate\Database\Eloquent\Collection', $routedata);
$this->assertInstanceOf('\App\Client', $client);
$this->assertInstanceOf('\App\ClientProfile', $clientProfile);
}
I made assumptions about the types of $client
and $clientProfile
, so you should adjust the classes accordingly.
Hopefully this helps.