Commit | Line | Data |
---|---|---|
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 |
27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
28 | class WebTest_Profile_DedupeTest extends CiviSeleniumTestCase { | |
29 | ||
30 | protected function setUp() { | |
31 | parent::setUp(); | |
32 | } | |
33 | ||
34 | function testProfileCreateDupeStrictDefault() { | |
6a488035 TO |
35 | // lets give profile related permision to anonymous user. |
36 | $permission = array('edit-1-profile-create', 'edit-1-profile-edit', 'edit-1-profile-listings', 'edit-1-profile-view'); | |
37 | $this->changePermissions($permission); | |
38 | ||
42daf119 CW |
39 | // Log in as normal user |
40 | $this->webtestLogin(); | |
41 | ||
38bf8139 | 42 | $this->openCiviPage('contact/add', 'reset=1&ct=Individual'); |
6a488035 TO |
43 | |
44 | $firstName = "John" . substr(sha1(rand()), 0, 7); | |
42daf119 CW |
45 | $lastName = "Smith" . substr(sha1(rand()), 0, 7); |
46 | $email = $firstName . "@" . $lastName . ".com"; | |
6a488035 TO |
47 | // fill in first name |
48 | $this->type("first_name", $firstName); | |
49 | ||
50 | // fill in last name | |
51 | $this->type("last_name", $lastName); | |
52 | ||
53 | // fill in email | |
54 | $this->type("email_1_email", $email); | |
55 | ||
56 | // Clicking save. | |
57 | $this->click("_qf_Contact_upload_view"); | |
58 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
59 | $individualName = $this->getText("xpath=//div[@class='crm-summary-display_name']"); | |
6c5f7368 | 60 | $this->waitForText('crm-notification-container', "$individualName has been created."); |
6a488035 TO |
61 | |
62 | // submit dupe using profile/create as anonymous | |
38bf8139 | 63 | $this->openCiviPage('profile/create', 'gid=4&reset=1', '_qf_Edit_next'); |
6a488035 TO |
64 | |
65 | $firstName = "John" . substr(sha1(rand()), 0, 7); | |
66 | $lastName = "Smith" . substr(sha1(rand()), 0, 7); | |
67 | ||
68 | // fill in first name | |
69 | $this->type("first_name", $firstName); | |
70 | ||
71 | // fill in last name | |
72 | $this->type("last_name", $lastName); | |
73 | ||
74 | // fill in email | |
75 | $this->type("email-Primary", $email); | |
76 | ||
77 | // click save | |
78 | $this->click("_qf_Edit_next"); | |
79 | $this->waitForTextPresent("A record already exists with the same information."); | |
80 | } | |
42daf119 | 81 | } |