Merge pull request #11087 from yashodha/CRM-19850
[civicrm-core.git] / tests / phpunit / WebTest / Mailing / ValidateBodyMailingComponentTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2018 |
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 /**
29 * Class WebTest_Mailing_ValidateBodyMailingComponentTest
30 */
31 class WebTest_Mailing_ValidateBodyMailingComponentTest extends CiviSeleniumTestCase {
32
33 protected function setUp() {
34 parent::setUp();
35 }
36
37 public function testWithoutBodyTextAndHTML() {
38 $this->webtestLogin();
39
40 $this->openCiviPage("admin/component", "action=add&reset=1");
41
42 // fill component name.
43 $componentName = 'ComponentName_' . substr(base_convert(rand(), 10, 36), 0, 7);
44 $this->type("name", $componentName);
45
46 // fill component type
47 $this->click("component_type");
48 $this->select("component_type", "value=Header");
49
50 // fill subject
51 $subject = "This is subject for New Mailing Component.";
52 $this->type("subject", $subject);
53
54 // fill no text message
55
56 // fill no html message
57
58 $this->click("is_default");
59 // Clicking save.
60 $this->click("_qf_Component_next");
61 $this->waitForPageToLoad($this->getTimeoutMsec());
62
63 // Is status message correct.
64 $status = "Please provide either HTML or TEXT format for the Body.";
65 $this->waitForText('crm-notification-container', $status);
66
67 // Verify the error text.
68 $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[2]/span[text()='{$status}']"), "The row doesn't consists of proper component details");
69 }
70
71 }