copyright and version fixes
[civicrm-core.git] / tests / phpunit / WebTest / Contact / DupeContactTest.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_Contact_DupeContactTest extends CiviSeleniumTestCase {
29
30 protected function setUp() {
31 parent::setUp();
32 }
33
34 function testDuplicateContactAdd() {
6a488035
TO
35 $this->webtestLogin();
36
d8bd5fb9 37 $this->openCiviPage('contact/add', 'reset=1&ct=Individual');
6a488035
TO
38
39 $firstName = substr(sha1(rand()), 0, 7);
40 $lastName1 = substr(sha1(rand()), 0, 7);
41 $email = "{$firstName}@example.com";
42 $lastName2 = substr(sha1(rand()), 0, 7);
43
44 //contact details section
45 //select prefix
46 $this->click("prefix_id");
47 $this->select("prefix_id", "value=3");
48
49 //fill in first name
50 $this->type("first_name", "$firstName");
51
52 //fill in last name
53 $this->type("last_name", "$lastName1");
54
55 //fill in email
56 $this->type("email_1_email", "$email");
57
58 //check for matching contact
59 //$this->click("_qf_Contact_refresh_dedupe");
60 //$this->waitForPageToLoad($this->getTimeoutMsec());
61
62 // Clicking save.
63 $this->click("_qf_Contact_upload_view");
64 $this->waitForPageToLoad($this->getTimeoutMsec());
6c5f7368 65 $this->waitForText('crm-notification-container', "Contact Saved");
6a488035 66
d8bd5fb9 67 $this->openCiviPage('contact/add' , 'reset=1&ct=Individual');
6a488035
TO
68
69 //contact details section
70
6a488035
TO
71 //fill in first name
72 $this->type("first_name", "$firstName");
73
74 //fill in last name
75 $this->type("last_name", "$lastName1");
76
77 //fill in email
78 $this->type("email_1_email", "$email");
79
80 // Clicking save.
81 $this->click("_qf_Contact_upload_view");
82 $this->waitForPageToLoad($this->getTimeoutMsec());
83
d8bd5fb9 84 $this->assertElementContainsText("css=.notify-content", "Please correct the following errors in the form fields below: One matching contact was found. You can View or Edit the existing contact.");
6a488035
TO
85 }
86}
87