Cannot create user with permissions created on the fly

alex_b - October 11, 2009 - 23:46
Project:SimpleTest
Version:6.x-2.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:boombatower
Status:postponed (maintainer needs more info)
Description

This may have some overlap with #295559: Cannot create user with permissions for contrib modules. but I think it is a distinct issue:

Problem:

I've got a situation where creating new configurations for imports create new permissions (e. g. "import [newtype] feeds"). checkPermissions() fails to verify these permissions created on the fly.

Analysis:

I *think* this happens because checkPermissions uses module_invoke_all('perm') to collect all available permissions but module_invoke_all('perm') gathers from the system that executes the tests - not the tested system that actually contains these permissions.

Is this analysis correct? What's the way to deal with this problem?

#1

boombatower - November 6, 2009 - 21:51
Assigned to:Anonymous» boombatower
Status:active» postponed (maintainer needs more info)

It shouldn't load the permissions until someone tries to create a user in a test and thus it does it in the tested environment.

Please try adding the following to your test before you create the user.

<?php
$this
->checkPermissions(array(), TRUE);
?>

If that fixes it then it is simply not refreshing and maybe we want a different solution.

 
 

Drupal is a registered trademark of Dries Buytaert.