<div dir="ltr">If you pass an array of permissions to drupalCreateUser() then it'll get those permissions, rather than the default ones for authenticated user. See the documentation here: <a href="http://drupal.org/node/265762">http://drupal.org/node/265762</a><br>
<br>Nat<br><br><div class="gmail_quote">On Mon, Aug 25, 2008 at 12:39 PM, Maarten van Grootel <span dir="ltr"><<a href="mailto:mvgrootel@gmail.com">mvgrootel@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr">Hello all,<br><br>I'm currently in the process of writing a 7.x patch to create the 'edit own comments' permission, to give admins the option to prohibit editing of comments. The functionality is working, but I would like to write a testcase for it, just to be complete. Here I found either a limitation of my understanding of the drupal testing framework, or a limitation of the framework itself. <br>
<br>Because the 'edit own comments' permission is on by default, (the 'authenticated user' role has the permission checked by default), any user created with drupalCreateUser($roles) will inherit the right to edit their own comment. Therefore, I can't make a test that checks that a person gets a 403 when trying to edit their post without the right permissions, because I can't disable the permission in the testing environment. <br>
<br>What I need, and can not find, is a function that will change the role_permission values for the 'authenticated user'-role, something like DrupalWebTestCase->drupalSetPermissions($role-id, $permissions). <br>
<br>Am I right to conclude that this can't be done with the current state of the Drupal WebTestCase? If so, do you have an idea how to solve this in an other way, or should I just leave the testcase out of the patch?<br>
<br>Thanks,<br>Maarten<br></div>
</blockquote></div><br></div>