9 months ago

Laravel HTTP Test trying to get property "object" of undefined

Posted 9 months ago by mlazuardy

I'm Using HTTP Test with PHPUnit to create test with users feature

but when i run mySampleTest like this;


while the method of index like this

  $users = User::paginate(15);
        return view('users.index',compact('users'));

and the view :

            @foreach ($users->where('id', '!=' ,auth()->id()) as $key => $user)
                    <a href="{{route('',$user->id)}}">Show</a>
                    <a href="{{route('users.edit',$user->id)}}">Edit</a>
                    <form action="{{route('users.destroy',$user->id)}}" method="post">
                        <button type="submit" class="btn btn-danger">Delete</button>

it throw an error like "trying to get property 'name' of undefined, what's the problem with my test code?

Please sign in or create an account to participate in this conversation.