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