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