Merge pull request #2549 from jitendrapurohit/CRM-13833
[civicrm-core.git] / tests / phpunit / WebTest / ACL / AssignUsersToRolesTest.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
232624b1 4 | CiviCRM version 4.4 |
6a488035
TO
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
6a488035
TO
27require_once 'CiviTest/CiviSeleniumTestCase.php';
28class WebTest_ACL_AssignUsersToRolesTest extends CiviSeleniumTestCase {
29
30 protected function setUp() {
31 parent::setUp();
32 }
33
34 function testAssignUsersToRoles() {
6a488035
TO
35
36 $this->webtestLogin();
42daf119 37
bb21371e 38 $this->openCiviPage("group/add", "reset=1");
6a488035
TO
39 $groupTitle = "testGroup" . substr(sha1(rand()), 0, 4);
40 $this->type("title", $groupTitle);
41 $this->click("group_type[1]");
42 $this->click("_qf_Edit_upload-bottom");
43 $this->waitForPageToLoad($this->getTimeoutMsec());
44
6c5f7368 45 $this->waitForText('crm-notification-container', "The Group '{$groupTitle}' has been saved.");
6a488035 46
118e964e 47 $this->openCiviPage("admin/options/acl_role", "action=add&reset=1", "_qf_Options_cancel-bottom");
6a488035
TO
48
49 $label = "TestAclRole" . substr(sha1(rand()), 0, 4);
50 $this->type("label", $label);
6c5f7368
CW
51 $this->clickLink("_qf_Options_next-bottom");
52
53 $this->waitForText('crm-notification-container', "The Acl Role '{$label}' has been saved");
6a488035 54
bb21371e 55 $this->openCiviPage("acl/entityrole", "action=add&reset=1");
6a488035
TO
56
57 $this->select("acl_role_id", "label=" . $label);
58 $this->select("entity_id", "label={$groupTitle}");
59
6c5f7368 60 $this->clickLink("_qf_EntityRole_next-botttom");
6a488035 61
bb21371e 62 $this->openCiviPage("acl", "action=add&reset=1");
6a488035
TO
63 $this->click("group_id");
64 $this->select("group_id", "label={$groupTitle}");
65 $this->select("operation", "label=View");
66 $this->select("entity_id", "label={$label}");
67 $this->type("name", "describe {$label}");
6c5f7368 68 $this->clickLink("_qf_ACL_next-bottom");
6a488035
TO
69 }
70}
71