3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
38 class Bug40247Test extends Sugar_PHPUnit_Framework_TestCase
40 var $has_custom_connectors_file;
41 var $has_custom_display_config_file;
42 var $has_custom_accounts_detailviewdefs_file;
43 var $has_custom_leads_detailviewdefs_file;
44 var $has_custom_contacts_detailviewdefs_file;
47 if(file_exists('custom/modules/connectors/metadata/connectors.php')) {
48 $this->has_custom_connectors_file = true;
49 copy('custom/modules/connectors/metadata/connectors.php', 'custom/modules/connectors/metadata/connectors.php.bak');
50 unlink('custom/modules/connectors/metadata/connectors.php');
53 if(file_exists('custom/modules/connectors/metadata/display_config.php')) {
54 $this->has_custom_display_config_file = true;
55 copy('custom/modules/connectors/metadata/display_config.php', 'custom/modules/connectors/metadata/display_config.php.bak');
56 unlink('custom/modules/connectors/metadata/display_config.php');
59 if(file_exists('custom/modules/accounts/metadata/detailviewdefs.php')) {
60 $this->has_custom_accounts_detailviewdefs_file = true;
61 copy('custom/modules/accounts/metadata/detailviewdefs.php', 'custom/modules/accounts/metadata/detailviewdefs.php.bak');
62 unlink('custom/modules/accounts/metadata/detailviewdefs.php');
65 if(file_exists('custom/modules/contactss/metadata/detailviewdefs.php')) {
66 $this->has_custom_contacts_detailviewdefs_file = true;
67 copy('custom/modules/contacts/metadata/detailviewdefs.php', 'custom/modules/contacts/metadata/detailviewdefs.php.bak');
68 unlink('custom/modules/contacts/metadata/detailviewdefs.php');
71 if(file_exists('custom/modules/accounts/metadata/detailviewdefs.php')) {
72 $this->has_custom_leads_detailviewdefs_file = true;
73 copy('custom/modules/leads/metadata/detailviewdefs.php', 'custom/modules/leads/metadata/detailviewdefs.php.bak');
74 unlink('custom/modules/leads/metadata/detailviewdefs.php');
77 if(file_exists('custom/modules/Connectors/metadata/mergeviewdefs.php')) {
78 unlink('custom/modules/Connectors/metadata/mergeviewdefs.php');
83 if($this->has_custom_connectors_file) {
84 copy('custom/modules/connectors/metadata/connectors.php.bak', 'custom/modules/connectors/metadata/connectors.php');
85 unlink('custom/modules/connectors/metadata/connectors.php.bak');
88 if($this->has_custom_display_config_file) {
89 copy('custom/modules/connectors/metadata/display_config.php.bak', 'custom/modules/connectors/metadata/display_config.php');
90 unlink('custom/modules/connectors/metadata/display_config.php.bak');
93 if($this->has_custom_accounts_detailviewdefs_file) {
94 copy('custom/modules/accounts/metadata/detailviewdefs.php.bak', 'custom/modules/accounts/metadata/detailviewdefs.php');
95 unlink('custom/modules/accounts/metadata/detailviewdefs.php.bak');
98 if($this->has_custom_contacts_detailviewdefs_file) {
99 copy('custom/modules/contacts/metadata/detailviewdefs.php.bak', 'custom/modules/contacts/metadata/detailviewdefs.php');
100 unlink('custom/modules/contacts/metadata/detailviewdefs.php.bak');
103 if($this->has_custom_leads_detailviewdefs_file) {
104 copy('custom/modules/leads/metadata/detailviewdefs.php.bak', 'custom/modules/leads/metadata/detailviewdefs.php');
105 unlink('custom/modules/leads/metadata/detailviewdefs.php.bak');
110 function test_default_com_connectors() {
111 $this->install_connectors();
112 if(!file_exists('custom/modules/connectors/metadata/display_config.php')) {
113 $this->markTestSkipped('Mark test skipped. Likely no permission to write to custom directory.');
118 require('modules/Accounts/metadata/detailviewdefs.php');
119 $this->assertFalse(in_array('CONNECTOR', $viewdefs['Accounts']['DetailView']['templateMeta']['form']['buttons']), "Assert that the Get Data button is not added to Accounts detailviewdefs.php file.");
121 $twitter_hover_link_set = false;
123 foreach($viewdefs['Accounts']['DetailView']['panels'] as $panels) {
124 foreach($panels as $panel) {
125 foreach($panel as $row=>$col) {
126 if(is_array($col) && $col['name'] == 'name') {
127 if(isset($col['displayParams']) && isset($col['displayParams']['connectors'])) {
128 foreach($col['displayParams']['connectors'] as $entry)
130 if($entry == 'ext_rest_twitter') {
131 $twitter_hover_link_set = true;
140 $this->assertFalse($twitter_hover_link_set, "Assert that the Twitter hover link is not set for Accounts.");
144 private function install_connectors() {
145 require('modules/Connectors/InstallDefaultConnectors.php');