It seems to be a flaw in your code. If you look closely you can see that you never assign the role the to the user using a relationship. Maybe because the user doesn't have a role you return true somewhere?
If you assign the role to the user and pass the wrong permission it should fail right! Otherwise you have a bug ;)
Are you doing the permission check through a Middleware or in the Controller? I would go to wherever that check is supposed to be performed, and dump() out various variables related to the permission check. Then run the tests again for more information.
@BishoyWagih You don't understand my point! Let me try again.
So when you create a user you say it has a role with ID of 1! Perfect. However in your test you create a new role using the factory that has that certain permission. How do you know that that role has an id of 1 that you just created? Maybe you created a role somewhere else and it has an id of 2 now? That means your user has another role and therefore not that permission!