Révision ae34fb26
Ajouté par Assos Assos il y a presque 4 ans
drupal7/sites/all/modules/content_access/tests/content_access.test | ||
---|---|---|
2 | 2 |
|
3 | 3 |
/** |
4 | 4 |
* @file |
5 |
* Automatd SimpleTest Case for content access module
|
|
5 |
* Automated SimpleTest Case for content access module.
|
|
6 | 6 |
*/ |
7 | 7 |
|
8 |
require_once(drupal_get_path('module', 'content_access') .'/tests/content_access_test_help.php');
|
|
8 |
require_once drupal_get_path('module', 'content_access') . '/tests/content_access_test_help.php';
|
|
9 | 9 |
|
10 | 10 |
class ContentAccessModuleTestCase extends ContentAccessTestCase { |
11 | 11 |
|
12 | 12 |
/** |
13 |
* Implementation of get_info() for information
|
|
13 |
* Implements get_info() for information.
|
|
14 | 14 |
*/ |
15 | 15 |
public static function getInfo() { |
16 | 16 |
return array( |
... | ... | |
23 | 23 |
function setUp($module = '') { |
24 | 24 |
parent::setUp(); |
25 | 25 |
|
26 |
// Create test nodes |
|
26 |
// Create test nodes.
|
|
27 | 27 |
$this->node1 = $this->drupalCreateNode(array('type' => $this->content_type->type)); |
28 | 28 |
$this->node2 = $this->drupalCreateNode(array('type' => $this->content_type->type)); |
29 | 29 |
} |
30 | 30 |
|
31 | 31 |
/** |
32 |
* Test for viewing nodes |
|
32 |
* Test for viewing nodes.
|
|
33 | 33 |
*/ |
34 | 34 |
function testViewAccess() { |
35 |
// Restrict access to the content type (access is only allowed for the author) |
|
35 |
// Restrict access to the content type (access is only allowed for the |
|
36 |
// author). |
|
36 | 37 |
$access_permissions = array( |
37 | 38 |
'view[1]' => FALSE, |
38 | 39 |
'view[2]' => FALSE, |
39 | 40 |
); |
40 | 41 |
$this->changeAccessContentType($access_permissions); |
41 | 42 |
|
42 |
// Logout admin and try to access the node anonymously |
|
43 |
// Logout admin and try to access the node anonymously.
|
|
43 | 44 |
$this->drupalLogout(); |
44 |
$this->drupalGet('node/'. $this->node1->nid); |
|
45 |
$this->drupalGet('node/' . $this->node1->nid);
|
|
45 | 46 |
$this->assertText(t('Access denied'), 'node is not viewable'); |
46 | 47 |
|
47 |
// Login test user, view node, access must be denied |
|
48 |
// Login test user, view node, access must be denied.
|
|
48 | 49 |
$this->drupalLogin($this->test_user); |
49 |
$this->drupalGet('node/'. $this->node1->nid); |
|
50 |
$this->drupalGet('node/' . $this->node1->nid);
|
|
50 | 51 |
$this->assertText(t('Access denied'), 'node is not viewable'); |
51 | 52 |
|
52 |
// Login admin and grant access for viewing to the test user |
|
53 |
// Login admin and grant access for viewing to the test user.
|
|
53 | 54 |
$this->drupalLogin($this->admin_user); |
54 | 55 |
$this->changeAccessContentTypeKeyword('view'); |
55 | 56 |
|
56 |
// Logout admin and try to access the node anonymously |
|
57 |
// access must be denied again
|
|
57 |
// Logout admin and try to access the node anonymously.
|
|
58 |
// Access must be denied again.
|
|
58 | 59 |
$this->drupalLogout(); |
59 |
$this->drupalGet('node/'. $this->node1->nid); |
|
60 |
$this->drupalGet('node/' . $this->node1->nid);
|
|
60 | 61 |
$this->assertText(t('Access denied'), 'node is not viewable'); |
61 | 62 |
|
62 |
// Login test user, view node, access must be granted |
|
63 |
// Login test user, view node, access must be granted.
|
|
63 | 64 |
$this->drupalLogin($this->test_user); |
64 |
$this->drupalGet('node/'. $this->node1->nid); |
|
65 |
$this->drupalGet('node/' . $this->node1->nid);
|
|
65 | 66 |
$this->assertNoText(t('Access denied'), 'node is viewable'); |
66 | 67 |
|
67 |
// Login admin and enable per node access |
|
68 |
// Login admin and enable per node access.
|
|
68 | 69 |
$this->drupalLogin($this->admin_user); |
69 | 70 |
$this->changeAccessPerNode(); |
70 | 71 |
|
71 |
// Restrict access on node2 for the test user role |
|
72 |
// Restrict access on node2 for the test user role.
|
|
72 | 73 |
$this->changeAccessNodeKeyword($this->node2, 'view', FALSE); |
73 | 74 |
|
74 |
// Logout admin and try to access both nodes anonymously |
|
75 |
// Logout admin and try to access both nodes anonymously.
|
|
75 | 76 |
$this->drupalLogout(); |
76 |
$this->drupalGet('node/'. $this->node1->nid); |
|
77 |
$this->drupalGet('node/' . $this->node1->nid);
|
|
77 | 78 |
$this->assertText(t('Access denied'), 'node1 is not viewable'); |
78 |
$this->drupalGet('node/'. $this->node2->nid); |
|
79 |
$this->drupalGet('node/' . $this->node2->nid);
|
|
79 | 80 |
$this->assertText(t('Access denied'), 'node2 is not viewable'); |
80 | 81 |
|
81 |
// Login test user, view node1, access must be granted |
|
82 |
// Login test user, view node1, access must be granted.
|
|
82 | 83 |
$this->drupalLogin($this->test_user); |
83 |
$this->drupalGet('node/'. $this->node1->nid); |
|
84 |
$this->drupalGet('node/' . $this->node1->nid);
|
|
84 | 85 |
$this->assertNoText(t('Access denied'), 'node1 is viewable'); |
85 | 86 |
|
86 |
// View node2, access must be denied |
|
87 |
$this->drupalGet('node/'. $this->node2->nid); |
|
87 |
// View node2, access must be denied.
|
|
88 |
$this->drupalGet('node/' . $this->node2->nid);
|
|
88 | 89 |
$this->assertText(t('Access denied'), 'node2 is not viewable'); |
89 | 90 |
|
90 |
// Login admin, swap permissions between content type and node2 |
|
91 |
// Login admin, swap permissions between content type and node2.
|
|
91 | 92 |
$this->drupalLogin($this->admin_user); |
92 | 93 |
|
93 |
// Restrict access to content type |
|
94 |
// Restrict access to content type.
|
|
94 | 95 |
$this->changeAccessContentTypeKeyword('view', FALSE); |
95 | 96 |
|
96 |
// Grant access to node2 |
|
97 |
// Grant access to node2.
|
|
97 | 98 |
$this->changeAccessNodeKeyword($this->node2, 'view'); |
98 | 99 |
|
99 |
// Logout admin and try to access both nodes anonymously |
|
100 |
// Logout admin and try to access both nodes anonymously.
|
|
100 | 101 |
$this->drupalLogout(); |
101 |
$this->drupalGet('node/'. $this->node1->nid); |
|
102 |
$this->drupalGet('node/' . $this->node1->nid);
|
|
102 | 103 |
$this->assertText(t('Access denied'), 'node1 is not viewable'); |
103 |
$this->drupalGet('node/'. $this->node2->nid); |
|
104 |
$this->drupalGet('node/' . $this->node2->nid);
|
|
104 | 105 |
$this->assertText(t('Access denied'), 'node2 is not viewable'); |
105 | 106 |
|
106 |
// Login test user, view node1, access must be denied |
|
107 |
// Login test user, view node1, access must be denied.
|
|
107 | 108 |
$this->drupalLogin($this->test_user); |
108 |
$this->drupalGet('node/'. $this->node1->nid); |
|
109 |
$this->drupalGet('node/' . $this->node1->nid);
|
|
109 | 110 |
$this->assertText(t('Access denied'), 'node1 is not viewable'); |
110 | 111 |
|
111 |
// View node2, access must be granted |
|
112 |
$this->drupalGet('node/'. $this->node2->nid); |
|
112 |
// View node2, access must be granted.
|
|
113 |
$this->drupalGet('node/' . $this->node2->nid);
|
|
113 | 114 |
$this->assertNoText(t('Access denied'), 'node2 is viewable'); |
114 | 115 |
} |
115 | 116 |
|
116 | 117 |
/** |
117 |
* Test for editing nodes |
|
118 |
* Test for editing nodes.
|
|
118 | 119 |
*/ |
119 | 120 |
function testEditAccess() { |
120 |
// Logout admin and try to edit the node anonymously |
|
121 |
// Logout admin and try to edit the node anonymously.
|
|
121 | 122 |
$this->drupalLogout(); |
122 |
$this->drupalGet('node/'. $this->node1->nid .'/edit');
|
|
123 |
$this->drupalGet('node/' . $this->node1->nid . '/edit');
|
|
123 | 124 |
$this->assertText(t('Access denied'), 'edit access denied for anonymous'); |
124 | 125 |
|
125 |
// Login test user, edit node, access must be denied |
|
126 |
// Login test user, edit node, access must be denied.
|
|
126 | 127 |
$this->drupalLogin($this->test_user); |
127 |
$this->drupalGet('node/'. $this->node1->nid .'/edit');
|
|
128 |
$this->drupalGet('node/' . $this->node1->nid . '/edit');
|
|
128 | 129 |
$this->assertText(t('Access denied'), 'edit access denied for test user'); |
129 | 130 |
|
130 |
// Login admin and grant access for editing to the test user |
|
131 |
// Login admin and grant access for editing to the test user.
|
|
131 | 132 |
$this->drupalLogin($this->admin_user); |
132 | 133 |
$this->changeAccessContentTypeKeyword('update'); |
133 | 134 |
|
134 |
// Logout admin and try to edit the node anonymously |
|
135 |
// access must be denied again
|
|
135 |
// Logout admin and try to edit the node anonymously.
|
|
136 |
// Access must be denied again.
|
|
136 | 137 |
$this->drupalLogout(); |
137 |
$this->drupalGet('node/'. $this->node1->nid .'/edit');
|
|
138 |
$this->drupalGet('node/' . $this->node1->nid . '/edit');
|
|
138 | 139 |
$this->assertText(t('Access denied'), 'edit access denied for anonymous'); |
139 | 140 |
|
140 |
// Login test user, edit node, access must be granted |
|
141 |
// Login test user, edit node, access must be granted.
|
|
141 | 142 |
$this->drupalLogin($this->test_user); |
142 |
$this->drupalGet('node/'. $this->node1->nid .'/edit');
|
|
143 |
$this->drupalGet('node/' . $this->node1->nid . '/edit');
|
|
143 | 144 |
$this->assertNoText(t('Access denied'), 'node1 is editable'); |
144 | 145 |
|
145 |
// Login admin and enable per node access |
|
146 |
// Login admin and enable per node access.
|
|
146 | 147 |
$this->drupalLogin($this->admin_user); |
147 | 148 |
$this->changeAccessPerNode(); |
148 | 149 |
|
149 |
// Restrict access for this content type for the test user |
|
150 |
// Restrict access for this content type for the test user.
|
|
150 | 151 |
$this->changeAccessContentTypeKeyword('update', FALSE); |
151 | 152 |
|
152 |
// Allow acces for node1 only |
|
153 |
// Allow acces for node1 only.
|
|
153 | 154 |
$this->changeAccessNodeKeyword($this->node1, 'update'); |
154 | 155 |
|
155 |
// Logout admin and try to edit both nodes anonymously |
|
156 |
// Logout admin and try to edit both nodes anonymously.
|
|
156 | 157 |
$this->drupalLogout(); |
157 |
$this->drupalGet('node/'. $this->node1->nid .'/edit');
|
|
158 |
$this->drupalGet('node/' . $this->node1->nid . '/edit');
|
|
158 | 159 |
$this->assertText(t('Access denied'), 'node1 is not editable'); |
159 |
$this->drupalGet('node/'. $this->node2->nid .'/edit');
|
|
160 |
$this->drupalGet('node/' . $this->node2->nid . '/edit');
|
|
160 | 161 |
$this->assertText(t('Access denied'), 'node2 is not editable'); |
161 | 162 |
|
162 |
// Login test user, edit node1, access must be granted |
|
163 |
// Login test user, edit node1, access must be granted.
|
|
163 | 164 |
$this->drupalLogin($this->test_user); |
164 |
$this->drupalGet('node/'. $this->node1->nid .'/edit');
|
|
165 |
$this->drupalGet('node/' . $this->node1->nid . '/edit');
|
|
165 | 166 |
$this->assertNoText(t('Access denied'), 'node1 is editable'); |
166 | 167 |
|
167 |
// Edit node2, access must be denied |
|
168 |
$this->drupalGet('node/'. $this->node2->nid .'/edit');
|
|
168 |
// Edit node2, access must be denied.
|
|
169 |
$this->drupalGet('node/' . $this->node2->nid . '/edit');
|
|
169 | 170 |
$this->assertText(t('Access denied'), 'node2 is not editable'); |
170 | 171 |
|
171 |
// Login admin, swap permissions between node1 and node2 |
|
172 |
// Login admin, swap permissions between node1 and node2.
|
|
172 | 173 |
$this->drupalLogin($this->admin_user); |
173 | 174 |
|
174 |
// Grant edit access to node2 |
|
175 |
// Grant edit access to node2.
|
|
175 | 176 |
$this->changeAccessNodeKeyword($this->node2, 'update'); |
176 |
// Restrict edit acces to node1 |
|
177 |
// Restrict edit acces to node1.
|
|
177 | 178 |
$this->changeAccessNodeKeyword($this->node1, 'update', FALSE); |
178 | 179 |
|
179 |
// Logout admin and try to edit both nodes anonymously |
|
180 |
// Logout admin and try to edit both nodes anonymously.
|
|
180 | 181 |
$this->drupalLogout(); |
181 |
$this->drupalGet('node/'. $this->node1->nid .'/edit');
|
|
182 |
$this->drupalGet('node/' . $this->node1->nid . '/edit');
|
|
182 | 183 |
$this->assertText(t('Access denied'), 'node1 is not editable'); |
183 |
$this->drupalGet('node/'. $this->node2->nid .'/edit');
|
|
184 |
$this->drupalGet('node/' . $this->node2->nid . '/edit');
|
|
184 | 185 |
$this->assertText(t('Access denied'), 'node2 is not editable'); |
185 | 186 |
|
186 |
// Login test user, edit node1, access must be denied |
|
187 |
// Login test user, edit node1, access must be denied.
|
|
187 | 188 |
$this->drupalLogin($this->test_user); |
188 |
$this->drupalGet('node/'. $this->node1->nid .'/edit');
|
|
189 |
$this->drupalGet('node/' . $this->node1->nid . '/edit');
|
|
189 | 190 |
$this->assertText(t('Access denied'), 'node1 is not editable'); |
190 | 191 |
|
191 |
// Edit node2, access must be granted |
|
192 |
$this->drupalGet('node/'. $this->node2->nid .'/edit');
|
|
192 |
// Edit node2, access must be granted.
|
|
193 |
$this->drupalGet('node/' . $this->node2->nid . '/edit');
|
|
193 | 194 |
$this->assertNoText(t('Access denied'), 'node2 is editable'); |
194 | 195 |
} |
195 | 196 |
|
196 | 197 |
/** |
197 |
* Test for deleting nodes |
|
198 |
* Test for deleting nodes.
|
|
198 | 199 |
*/ |
199 | 200 |
function testDeleteAccess() { |
200 |
// Logout admin and try to delete the node anonymously |
|
201 |
// Logout admin and try to delete the node anonymously.
|
|
201 | 202 |
$this->drupalLogout(); |
202 |
$this->drupalGet('node/'. $this->node1->nid .'/delete');
|
|
203 |
$this->drupalGet('node/' . $this->node1->nid . '/delete');
|
|
203 | 204 |
$this->assertText(t('Access denied'), 'delete access denied for anonymous'); |
204 | 205 |
|
205 |
// Login test user, delete node, access must be denied |
|
206 |
// Login test user, delete node, access must be denied.
|
|
206 | 207 |
$this->drupalLogin($this->test_user); |
207 |
$this->drupalGet('node/'. $this->node1->nid .'/delete');
|
|
208 |
$this->drupalGet('node/' . $this->node1->nid . '/delete');
|
|
208 | 209 |
$this->assertText(t('Access denied'), 'delete access denied for test user'); |
209 | 210 |
|
210 |
// Login admin and grant access for deleting to the test user |
|
211 |
// Login admin and grant access for deleting to the test user.
|
|
211 | 212 |
$this->drupalLogin($this->admin_user); |
212 | 213 |
|
213 | 214 |
$this->changeAccessContentTypeKeyword('delete'); |
214 | 215 |
|
215 |
// Logout admin and try to edit the node anonymously |
|
216 |
// access must be denied again
|
|
216 |
// Logout admin and try to edit the node anonymously.
|
|
217 |
// Access must be denied again.
|
|
217 | 218 |
$this->drupalLogout(); |
218 |
$this->drupalGet('node/'. $this->node1->nid .'/delete');
|
|
219 |
$this->drupalGet('node/' . $this->node1->nid . '/delete');
|
|
219 | 220 |
$this->assertText(t('Access denied'), 'delete access denied for anonymous'); |
220 | 221 |
|
221 |
// Login test user, delete node, access must be granted |
|
222 |
// Login test user, delete node, access must be granted.
|
|
222 | 223 |
$this->drupalLogin($this->test_user); |
223 |
$this->drupalPost('node/'. $this->node1->nid .'/delete', array(), 'Delete');
|
|
224 |
$this->drupalPost('node/' . $this->node1->nid . '/delete', array(), 'Delete');
|
|
224 | 225 |
$this->assertRaw(t('%node has been deleted', array('%node' => $this->node1->title)), 'Test node was deleted successfully by test user'); |
225 | 226 |
|
226 |
// Login admin and recreate test node1 |
|
227 |
// Login admin and recreate test node1.
|
|
227 | 228 |
$this->drupalLogin($this->admin_user); |
228 | 229 |
$this->node1 = $this->drupalCreateNode(array('type' => $this->content_type->type)); |
229 | 230 |
|
230 |
// Enable per node access |
|
231 |
// Enable per node access.
|
|
231 | 232 |
$this->changeAccessPerNode(); |
232 | 233 |
|
233 |
// Restrict access for this content type for the test user |
|
234 |
// Restrict access for this content type for the test user.
|
|
234 | 235 |
$this->changeAccessContentTypeKeyword('delete', FALSE); |
235 | 236 |
|
236 |
// Allow acces for node1 only |
|
237 |
// Allow acces for node1 only.
|
|
237 | 238 |
$this->changeAccessNodeKeyword($this->node1, 'delete'); |
238 | 239 |
|
239 |
// Logout admin and try to delete both nodes anonymously |
|
240 |
// Logout admin and try to delete both nodes anonymously.
|
|
240 | 241 |
$this->drupalLogout(); |
241 |
$this->drupalGet('node/'. $this->node1->nid .'/delete');
|
|
242 |
$this->drupalGet('node/' . $this->node1->nid . '/delete');
|
|
242 | 243 |
$this->assertText(t('Access denied'), 'node1 is not deletable'); |
243 |
$this->drupalGet('node/'. $this->node2->nid .'/delete');
|
|
244 |
$this->drupalGet('node/' . $this->node2->nid . '/delete');
|
|
244 | 245 |
$this->assertText(t('Access denied'), 'node2 is not deletable'); |
245 | 246 |
|
246 |
// Login test user, delete node1, access must be granted |
|
247 |
// Login test user, delete node1, access must be granted.
|
|
247 | 248 |
$this->drupalLogin($this->test_user); |
248 |
$this->drupalGet('node/'. $this->node1->nid .'/delete');
|
|
249 |
$this->drupalGet('node/' . $this->node1->nid . '/delete');
|
|
249 | 250 |
$this->assertNoText(t('Access denied'), 'node1 is deletable'); |
250 | 251 |
|
251 |
// Delete node2, access must be denied |
|
252 |
$this->drupalGet('node/'. $this->node2->nid .'/delete');
|
|
252 |
// Delete node2, access must be denied.
|
|
253 |
$this->drupalGet('node/' . $this->node2->nid . '/delete');
|
|
253 | 254 |
$this->assertText(t('Access denied'), 'node2 is not deletable'); |
254 | 255 |
|
255 |
// Login admin, swap permissions between node1 and node2 |
|
256 |
// Login admin, swap permissions between node1 and node2.
|
|
256 | 257 |
$this->drupalLogin($this->admin_user); |
257 | 258 |
|
258 |
// Grant delete access to node2 |
|
259 |
// Grant delete access to node2.
|
|
259 | 260 |
$this->changeAccessNodeKeyword($this->node2, 'delete'); |
260 |
// Restrict delete acces to node1 |
|
261 |
// Restrict delete acces to node1.
|
|
261 | 262 |
$this->changeAccessNodeKeyword($this->node1, 'delete', FALSE); |
262 | 263 |
|
263 |
// Logout admin and try to delete both nodes anonymously |
|
264 |
// Logout admin and try to delete both nodes anonymously.
|
|
264 | 265 |
$this->drupalLogout(); |
265 |
$this->drupalGet('node/'. $this->node1->nid .'/delete');
|
|
266 |
$this->drupalGet('node/' . $this->node1->nid . '/delete');
|
|
266 | 267 |
$this->assertText(t('Access denied'), 'node1 is not deletable'); |
267 |
$this->drupalGet('node/'. $this->node2->nid .'/delete');
|
|
268 |
$this->drupalGet('node/' . $this->node2->nid . '/delete');
|
|
268 | 269 |
$this->assertText(t('Access denied'), 'node2 is not deletable'); |
269 | 270 |
|
270 |
// Login test user, delete node1, access must be denied |
|
271 |
// Login test user, delete node1, access must be denied.
|
|
271 | 272 |
$this->drupalLogin($this->test_user); |
272 |
$this->drupalGet('node/'. $this->node1->nid .'/delete');
|
|
273 |
$this->drupalGet('node/' . $this->node1->nid . '/delete');
|
|
273 | 274 |
$this->assertText(t('Access denied'), 'node1 is not deletable'); |
274 | 275 |
|
275 |
// Delete node2, access must be granted |
|
276 |
$this->drupalGet('node/'. $this->node2->nid .'/delete');
|
|
276 |
// Delete node2, access must be granted.
|
|
277 |
$this->drupalGet('node/' . $this->node2->nid . '/delete');
|
|
277 | 278 |
$this->assertNoText(t('Access denied'), 'node2 is deletable'); |
278 | 279 |
} |
279 | 280 |
|
280 | 281 |
/** |
281 |
* Test own view access |
|
282 |
* Test own view access.
|
|
282 | 283 |
*/ |
283 | 284 |
function testOwnViewAccess() { |
284 |
// Setup 2 test users |
|
285 |
// Setup 2 test users.
|
|
285 | 286 |
$test_user1 = $this->test_user; |
286 |
$test_user2 = $this->drupalCreateUser(); |
|
287 |
$test_user2 = $this->drupalCreateUser(array('access content'));
|
|
287 | 288 |
|
288 |
// Change ownership of test nodes to test users |
|
289 |
// Change ownership of test nodes to test users.
|
|
289 | 290 |
$this->node1->uid = $test_user1->uid; |
290 | 291 |
node_save($this->node1); |
291 | 292 |
$this->node2->uid = $test_user2->uid; |
292 | 293 |
node_save($this->node2); |
293 | 294 |
|
294 |
// Remove all view permissions for this content type |
|
295 |
// Remove all view permissions for this content type.
|
|
295 | 296 |
$access_permissions = array( |
296 | 297 |
'view[1]' => FALSE, |
297 | 298 |
'view[2]' => FALSE, |
... | ... | |
300 | 301 |
); |
301 | 302 |
$this->changeAccessContentType($access_permissions); |
302 | 303 |
|
303 |
// Allow view own content for test user 1 and 2 roles |
|
304 |
// Allow view own content for test user 1 and 2 roles.
|
|
304 | 305 |
$this->changeAccessContentTypeKeyword('view_own', TRUE, $test_user1); |
305 | 306 |
$this->changeAccessContentTypeKeyword('view_own', TRUE, $test_user2); |
306 | 307 |
|
307 |
// Logout admin and try to access both nodes anonymously |
|
308 |
// Logout admin and try to access both nodes anonymously.
|
|
308 | 309 |
$this->drupalLogout(); |
309 |
$this->drupalGet('node/'. $this->node1->nid); |
|
310 |
$this->drupalGet('node/' . $this->node1->nid);
|
|
310 | 311 |
$this->assertText(t('Access denied'), 'node1 is not viewable'); |
311 |
$this->drupalGet('node/'. $this->node2->nid); |
|
312 |
$this->drupalGet('node/' . $this->node2->nid);
|
|
312 | 313 |
$this->assertText(t('Access denied'), 'node2 is not viewable'); |
313 | 314 |
|
314 |
// Login test user 1, view node1, access must be granted |
|
315 |
// Login test user 1, view node1, access must be granted.
|
|
315 | 316 |
$this->drupalLogin($test_user1); |
316 |
$this->drupalGet('node/'. $this->node1->nid); |
|
317 |
$this->drupalGet('node/' . $this->node1->nid);
|
|
317 | 318 |
$this->assertNoText(t('Access denied'), 'node1 is viewable'); |
318 | 319 |
|
319 |
// View node2, access must be denied |
|
320 |
$this->drupalGet('node/'. $this->node2->nid); |
|
320 |
// View node2, access must be denied.
|
|
321 |
$this->drupalGet('node/' . $this->node2->nid);
|
|
321 | 322 |
$this->assertText(t('Access denied'), 'node2 is not viewable'); |
322 | 323 |
|
323 |
// Login test user 2, view node1, access must be denied |
|
324 |
// Login test user 2, view node1, access must be denied.
|
|
324 | 325 |
$this->drupalLogin($test_user2); |
325 |
$this->drupalGet('node/'. $this->node1->nid); |
|
326 |
$this->drupalGet('node/' . $this->node1->nid);
|
|
326 | 327 |
$this->assertText(t('Access denied'), 'node1 is not viewable'); |
327 | 328 |
|
328 |
// View node2, access must be granted |
|
329 |
$this->drupalGet('node/'. $this->node2->nid); |
|
329 |
// View node2, access must be granted.
|
|
330 |
$this->drupalGet('node/' . $this->node2->nid);
|
|
330 | 331 |
$this->assertNoText(t('Access denied'), 'node2 is viewable'); |
331 | 332 |
} |
332 |
} |
|
333 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules