Merge pull request #203 from mlutfy/CRM-11755
[civicrm-core.git] / tests / phpunit / WebTest / ACL / AssignUsersToRolesTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25 */
26
27
28 require_once 'CiviTest/CiviSeleniumTestCase.php';
29 class WebTest_ACL_AssignUsersToRolesTest extends CiviSeleniumTestCase {
30
31 protected function setUp() {
32 parent::setUp();
33 }
34
35 function testAssignUsersToRoles() {
36
37 $this->webtestLogin();
38
39 $this->openCiviPage("group/add", "reset=1");
40 $groupTitle = "testGroup" . substr(sha1(rand()), 0, 4);
41 $this->type("title", $groupTitle);
42 $this->click("group_type[1]");
43 $this->click("_qf_Edit_upload-bottom");
44 $this->waitForPageToLoad($this->getTimeoutMsec());
45
46 $this->assertElementContainsText('crm-notification-container', "The Group '{$groupTitle}' has been saved.");
47
48 $this->openCiviPage("admin/options/acl_role", "group=acl_role&action=add&reset=1", "_qf_Options_cancel-bottom");
49
50 $label = "TestAclRole" . substr(sha1(rand()), 0, 4);
51 $this->type("label", $label);
52 $this->click("_qf_Options_next-bottom");
53 $this->waitForPageToLoad($this->getTimeoutMsec());
54 $this->assertElementContainsText('crm-notification-container', "The Acl Role '{$label}' has been saved");
55
56 $this->openCiviPage("acl/entityrole", "action=add&reset=1");
57
58 $this->select("acl_role_id", "label=" . $label);
59 $this->select("entity_id", "label={$groupTitle}");
60
61 $this->click("_qf_EntityRole_next-botttom");
62 $this->waitForPageToLoad($this->getTimeoutMsec());
63
64 $this->openCiviPage("acl", "action=add&reset=1");
65 $this->click("group_id");
66 $this->select("group_id", "label={$groupTitle}");
67 $this->select("operation", "label=View");
68 $this->select("entity_id", "label={$label}");
69 $this->type("name", "describe {$label}");
70 $this->click("_qf_ACL_next-bottom");
71 $this->waitForPageToLoad($this->getTimeoutMsec());
72 }
73 }
74