Add unit test for #hasPermission()