This is my function :
public function index(Request $request)
{
$data = User::all();
return view('data.index',[
'data' => $data
]);
}
I write a test for this
public function testIndex()
{
$response = $this->call('GET', '/data');
$this->assertEquals(200, $response->status());
}
but not works. Show redirection
Response status code [302] is not a successful status code.
Failed asserting that false is true.
Here is my route:
Route::group(['prefix' => 'data'], function() {
Route::get('/', ['as' => 'data.index', 'uses' => 'DataController@index']);
});
I tried everything but still showing the same thing.