Révision ae34fb26
Ajouté par Assos Assos il y a presque 4 ans
drupal7/sites/all/modules/content_access/tests/content_access_test_help.php | ||
---|---|---|
34 | 34 |
} |
35 | 35 |
} |
36 | 36 |
|
37 |
// Create test user with seperate role
|
|
38 |
$this->test_user = $this->drupalCreateUser(); |
|
37 |
// Create test user with separate role.
|
|
38 |
$this->test_user = $this->drupalCreateUser(array('access content'));
|
|
39 | 39 |
|
40 |
// Get the value of the new role |
|
41 |
// Needed in D7 because it's by default create two roles for new users
|
|
42 |
// one role is Authenticated and the second is new default one
|
|
40 |
// Get the value of the new role.
|
|
41 |
// Needed in D7 because drupalCreateUser() creates two roles for new users:
|
|
42 |
// one role is Authenticated and the second has the given permissions.
|
|
43 | 43 |
// @see drupalCreateUser() |
44 |
foreach ($this->test_user->roles as $rid => $role) { |
|
45 |
if (!in_array($rid, array(DRUPAL_AUTHENTICATED_RID))) { |
|
46 |
$this->rid = $rid; |
|
47 |
break; |
|
48 |
} |
|
49 |
} |
|
44 |
$roles = $this->test_user->roles; |
|
45 |
unset($roles[DRUPAL_AUTHENTICATED_RID]); |
|
46 |
$this->rid = key($roles); |
|
50 | 47 |
|
51 | 48 |
// Create admin user |
52 |
$this->admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'grant content access', 'grant own content access', 'administer nodes', 'access administration pages')); |
|
49 |
$this->admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'grant content access', 'grant own content access', 'bypass node access', 'administer nodes', 'access administration pages'));
|
|
53 | 50 |
$this->drupalLogin($this->admin_user); |
54 | 51 |
|
55 | 52 |
// Rebuild content access permissions |
... | ... | |
122 | 119 |
$this->drupalPost('node/'. $node->nid .'/access', $access_settings, t('Submit')); |
123 | 120 |
$this->assertText(t('Your changes have been saved.'), 'access rules of node were updated successfully'); |
124 | 121 |
} |
125 |
} |
|
122 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules