phpMick's avatar
Level 15

Test tokenCan()

Hi,

I'm trying to test some code which is protected by tokenCan() (https://laravel.com/docs/8.x/passport#checking-scopes-on-a-token-instance).

How can I test this code? The tokenCan() always fails because middleware is disabled in my tests (and therefore there isn't a token).

Cheers,

Mick

0 likes
3 replies
phpMick's avatar
Level 15

I'm just sticking the middleware back in for this test and creating a token with the correct scope.

Please or to participate in this conversation.