2 /*********************************************************************************
3 * By installing or using this file, you are confirming on behalf of the entity
4 * subscribed to the SugarCRM Inc. product ("Company") that Company is bound by
5 * the SugarCRM Inc. Master Subscription Agreement (“MSA”), which is viewable at:
6 * http://www.sugarcrm.com/master-subscription-agreement
8 * If Company is not bound by the MSA, then by installing or using this file
9 * you are agreeing unconditionally that Company will be bound by the MSA and
10 * certifying that you have authority to bind Company accordingly.
12 * Copyright (C) 2004-2013 SugarCRM Inc. All rights reserved.
13 ********************************************************************************/
16 require_once 'modules/vCals/vCal.php';
20 * GOTO MEETING ceation in SugarCRM does not dispay goto info in attachment
22 * @author bsitnikovski@sugarcrm.com
25 class Bug62943Test extends Sugar_PHPUnit_Framework_TestCase
28 public function setUp()
30 $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
31 $GLOBALS['current_user']->full_name = "Boro Sitnikovski";
32 $GLOBALS['current_user']->email1 = "bsitnikovski@sugarcrm.com";
35 public function tearDown()
37 SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
38 unset($GLOBALS['current_user']);
41 public function testiCalNewline()
43 $res = vCal::get_ical_event($this->_getDummyBean("http://www.sugarcrm.com/"), $GLOBALS['current_user']);
45 $desc = $this->grabiCalField($res, "DESCRIPTION");
46 // Test to see if there are two newlines after url for description
47 $this->assertContains("http://www.sugarcrm.com/\r\n\r\n", $desc);
50 public function testiCalEmptyJoinURL()
52 $res = vCal::get_ical_event($this->_getDummyBean(), $GLOBALS['current_user']);
54 $desc = $this->grabiCalField($res, "DESCRIPTION");
56 // Test to see if there are no newlines for empty url for description
57 $this->assertNotContains("\\n\\n", $desc);
60 private function grabiCalField($iCal, $field)
62 $ical_arr = vCal::create_ical_array_from_string($iCal);
64 foreach ($ical_arr as $ical_val) {
65 if ($ical_val[0] == $field) {
73 private function _getDummyBean($join_url = "")
75 $bean = new SugarBean();
77 $bean->date_start = $bean->date_end = $GLOBALS['timedate']->nowDb();
78 $bean->name = "Dummy Bean";
79 $bean->location = "Sugar, Cupertino; Sugar, EMEA";
80 $bean->join_url = $join_url;
81 $bean->description = "Hello, this is a dummy description.\nIt contains newlines, backslash \\ semicolon ; and commas";