CRM-13970 - Option form url fix & test cleanup
[civicrm-core.git] / tests / phpunit / WebTest / ACL / AssignUsersToRolesTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
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 require_once 'CiviTest/CiviSeleniumTestCase.php';
28 class WebTest_ACL_AssignUsersToRolesTest extends CiviSeleniumTestCase {
29
30 protected function setUp() {
31 parent::setUp();
32 }
33
34 function testAssignUsersToRoles() {
35
36 $this->webtestLogin();
37
38 $this->openCiviPage("group/add", "reset=1");
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
45 $this->waitForText('crm-notification-container', "The Group '{$groupTitle}' has been saved.");
46
47 $this->openCiviPage("admin/options/acl_role", "action=add&reset=1", "_qf_Options_cancel-bottom");
48
49 $label = "TestAclRole" . substr(sha1(rand()), 0, 4);
50 $this->type("label", $label);
51 $this->clickLink("_qf_Options_next-bottom");
52
53 $this->waitForText('crm-notification-container', "The Acl Role '{$label}' has been saved");
54
55 $this->openCiviPage("acl/entityrole", "action=add&reset=1");
56
57 $this->select("acl_role_id", "label=" . $label);
58 $this->select("entity_id", "label={$groupTitle}");
59
60 $this->clickLink("_qf_EntityRole_next-botttom");
61
62 $this->openCiviPage("acl", "action=add&reset=1");
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}");
68 $this->clickLink("_qf_ACL_next-bottom");
69 }
70 }
71