Answer the question
In order to leave comments, you need to log in
Why are laravel tests not passing?
doing feature tests
public function create()
{
$response= $this->actingAs($this->admin)->post('/admin/users',[
'name'=>'Test Name',
'email'=>'[email protected]'
]);
$user=User::where('email','[email protected]')->first();
$response->assertStatus(302)
->assertRedirect('/admin/users/'.$user->id);
}
Route::group(
[
'prefix' => 'admin',
'as' => 'admin.',
'namespace' => 'Admin',
'middleware' => ['auth', 'can:admin-panel'],
],
function () {
...
Route::resource('users', 'UsersController');
...
}
public function store(CreateRequest $request)
{
$user = User::new($request);
return redirect()->route('admin.users.show', $user);
}
1) Tests\Feature\Admin\UserTest::create
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'http://localhost/admin/users/9e364fb9-6079-473b-b449-9fe9bd4992cb'
+'http://localhost'
/www/app/vendor/laravel/framework/src/Illuminate/Testing/TestResponse.php:260
/www/app/vendor/laravel/framework/src/Illuminate/Testing/TestResponse.php:205
/www/app/tests/Feature/Admin/UserTest.php:64
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question