Comments & Discussion
Small things, in these methods:
test_company_owner_cannot_delete_user_for_other_company
test_company_owner_can_delete_user_for_his_company
test_admin_can_delete_user_for_a_company
( route name should be destroy not update )
$response = $this->actingAs($user)->delete(route('companies.users.destroy', [$company2->id, $user->id]));
question, why did you use the ff code in the navigation section:
request()->routeIs('companies.users.*')
instead of:
request()->routeIs('companies.users.index', auth()->user()->company_id)
is it to make the code shorter?
To just make it more obvious:
companies.users.index will only match that route. But what if you go inside the create/edit pages? Then the route is not going to be marked as active. This means that the navigation will be in an incorrect state.
Now adding the * to the url as companies.users.* will make it match ANYTHING that is inside there. For example:
companies.users.index
companies.users.create
companies.users.edit
All of the above will match and correctly mark the active navigation due to the * wildcard
Grate class having a lot of fun learning new things at least for me. However on this part of the test I am not getting all green I have one error that I am having a bit of trouble figuring out
Can’t find the edit in the policies\Company User Policy page
I started over from scratch and BOY AM I GLADE! All test passed even the one on this page.