1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Tests for chain_menu_access.module.
|
6
|
*/
|
7
|
|
8
|
class CmaWebTestCase extends DrupalWebTestCase {
|
9
|
|
10
|
protected $web_user;
|
11
|
|
12
|
public static function getInfo() {
|
13
|
return array(
|
14
|
'name' => 'Chain Menu Access API',
|
15
|
'description' => 'Test altering menu access via chained access functions.',
|
16
|
'group' => 'Chain Menu Access API',
|
17
|
);
|
18
|
}
|
19
|
|
20
|
function setUp() {
|
21
|
parent::setUp('chain_menu_access', 'chain_menu_access_test'); //, 'devel');
|
22
|
$this->web_user = $this->drupalCreateUser(array('create page content')); //, 'access devel information'));
|
23
|
$this->drupalLogin($this->web_user);
|
24
|
}
|
25
|
|
26
|
/**
|
27
|
* Test making a third-level administrative path available to anon.
|
28
|
*/
|
29
|
function testAdminAccess() {
|
30
|
|
31
|
$this->drupalGet('admin');
|
32
|
$this->assertResponse(403, "Cannot normally access 'admin'.");
|
33
|
$this->drupalGet('admin/people');
|
34
|
$this->assertResponse(403, "Cannot normally access 'admin/people'.");
|
35
|
$this->drupalGet('admin/people/create');
|
36
|
$this->assertResponse(403, "Cannot normally access 'admin/people/create'.");
|
37
|
|
38
|
$this->drupalGet('admin', array('query' => array('enable_cma' => 1)));
|
39
|
$this->assertResponse(403, "Still cannot access 'admin'.");
|
40
|
$this->drupalGet('admin/people', array('query' => array('enable_cma' => 1)));
|
41
|
$this->assertResponse(403, "Still cannot access 'admin/people'.");
|
42
|
$this->drupalGet('admin/people/create', array('query' => array('enable_cma' => 1)));
|
43
|
$this->assertResponse(200, "Can access 'admin/people/create' now. It's redirected to user/UID though, but that's caused by user_register_form(), which is outside of our scope.");
|
44
|
}
|
45
|
|
46
|
}
|