开发者

User Impersonation for CakePHP Auth component

开发者 https://www.devze.com 2023-03-10 02:05 出处:网络
In CakePHP Auth Component it is possible to have adm开发者_Go百科in user (or a group ) to impersonate any user in the system for testing purpose?Really you shouldn\'t be testing this live anyways. It

In CakePHP Auth Component it is possible to have adm开发者_Go百科in user (or a group ) to impersonate any user in the system for testing purpose?


Really you shouldn't be testing this live anyways. It sounds to me like you want to test logging in and using the site as users other than the admin.

This seems like a perfect case for unit tests. Write a test, mock an auth'ed user object and and run some code as that mocked user. Make a mock user for each access level you use in the site. It will be much more reliable and reproducible.

The manual has some good info on testing - as does the blog http://www.dereuromark.de/ and a quick search on this site brings up a ton of useful hints / techniques.

0

精彩评论

暂无评论...
验证码 换一张
取 消