dimanche 23 avril 2017

laravel index method test The response was not a view. Failed asserting that false is true

this is my test function for index function

/** @test */

public function testIndex()
{
    $this->call('GET', '/backend/route-data');

    $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);

}

this is the index function

public function index($alias, $profileId) { $this->setClientAndClientProfile($alias, $profileId);

$routeData = RouteData
                    ::where('client_id', $this->client->id)
                    ->paginate(10);

return view('client.route_data.index', compact('routeData'))->with('client', $this->client)->with('clientProfile', $this->clientProfile);

}

I got this error RouteIndex::testIndex The response was not a view. Failed asserting that false is true. how I can fix this :)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire