Instead of the 403 Forbidden response which tests expect my appliacation's API started returning status codes of 500 with an Illuminate\Auth\Access\AuthorizationException: This action is unauthorized. error. It used to work (the test were passing) but the app suddenly changed its behavior and I'm no...
The first time I observed the issue I thouhgt the Vue frontend was broken but as I examined the XHR requests I noticed that the problem wasn't in the Vue app. In the returned data JSON there were 2 duplcate ids. I've now experienced this a few times and I've noticed that it happens when a user delet...
How should I test image file upload to my API? I tried using faker to provide me with an image in the feature test but it doesn't work. The test would freeze and after a while when I dd($this->image); it would say false. This is my code:$this->image = $this->faker->image($dir = base_path('tests\Feat...
I'm developing a Laravel application with an API in which users have roles and roles have permissions. Currently I'm trying to assign a permission to a role, but I don't really know how to do it as the GET request to the API returns a JSON resource which I can't use to access the many-to-many relati...
Hi, When I'm trying to $response->assertJsonCount(2); I get Failed asserting that actual size 1 matches expected size 2. My controller index method returns ExampleResource::collection(ExampleModel::all()); which has the necessary data in it for the 2 records I have. How can I assert the count of the...
I'm making a laravel application in which when creating a particular record in the DB, one of the colums has to be set depending on another one. It extracts some info from a field and based upon that info it searches in the DB for the id of a record from another table that matches the requirements a...