Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
AccountContactAffiliationsDesignerSuperUserWalkthroughTest.php
1 <?php
2  /*********************************************************************************
3  * Zurmo is a customer relationship management program developed by
4  * Zurmo, Inc. Copyright (C) 2017 Zurmo Inc.
5  *
6  * Zurmo is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  *
13  * Zurmo is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  *
23  * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive
24  * Suite 370 Chicago, IL 60606. or at email address contact@zurmo.com.
25  *
26  * The interactive user interfaces in original and modified versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  *
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the Zurmo
32  * logo and Zurmo copyright notice. If the display of the logo is not reasonably
33  * feasible for technical reasons, the Appropriate Legal Notices must display the words
34  * "Copyright Zurmo Inc. 2017. All rights reserved".
35  ********************************************************************************/
36 
47  {
48  public static $activateDefaultLanguages = true;
49 
50  protected static $account;
51 
52  protected static $contact;
53 
54  public static function setUpBeforeClass()
55  {
56  parent::setUpBeforeClass();
57  SecurityTestHelper::createSuperAdmin();
58  $super = User::getByUsername('super');
59  Yii::app()->user->userModel = $super;
60  Currency::makeBaseCurrency();
61 
62  //Setup test data owned by the super user.
63  self::$account = AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
64  self::$contact = ContactTestHelper::createContactByNameForOwner('superContact2', $super);
65  }
66 
67  public function testSuperUserAccountContactAffiliationDefaultControllerActions()
68  {
69  $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
70  //Default Controller actions requiring some sort of parameter via POST or GET
71  //Load AccountContactAffiliation Modules Menu.
72  $this->resetPostArray();
73  $this->setGetArray(array('moduleClassName' => 'AccountContactAffiliationsModule'));
74  $this->runControllerWithNoExceptionsAndGetContent('designer/default/modulesMenu');
75 
76  //Load AttributesList for AccountContactAffiliation module.
77  $this->resetPostArray();
78  $this->setGetArray(array('moduleClassName' => 'AccountContactAffiliationsModule'));
79  $this->runControllerWithNoExceptionsAndGetContent('designer/default/attributesList');
80 
81  //Load ModuleLayoutsList for AccountContactAffiliation module.
82  $this->resetPostArray();
83  $this->setGetArray(array('moduleClassName' => 'AccountContactAffiliationsModule'));
84  $this->runControllerWithNoExceptionsAndGetContent('designer/default/moduleLayoutsList');
85 
86  //Load ModuleEdit view for each applicable module.
87  $this->resetPostArray();
88  $this->setGetArray(array('moduleClassName' => 'AccountContactAffiliationsModule'));
89  $this->runControllerWithNoExceptionsAndGetContent('designer/default/moduleEdit');
90 
91  //Now validate save with failed validation.
92  $this->setGetArray(array('moduleClassName' => 'AccountContactAffiliationsModule'));
93  $this->setPostArray(array('ajax' => 'edit-form',
94  'AccountsModuleForm' => $this->createModuleEditBadValidationPostData()));
95  $content = $this->runControllerWithExitExceptionAndGetContent('designer/default/moduleEdit');
96 
97  //Now validate save with successful validation.
98  $this->setGetArray(array('moduleClassName' => 'AccountContactAffiliationsModule'));
99  $this->setPostArray(array('ajax' => 'edit-form',
100  'AccountsModuleForm' => $this->createModuleEditGoodValidationPostData('acc new name')));
101  $content = $this->runControllerWithExitExceptionAndGetContent('designer/default/moduleEdit');
102  $this->assertEquals('[]', $content);
103 
104  //Load LayoutEdit for each applicable module and applicable layout
105  $this->resetPostArray();
106  $this->setGetArray(array('moduleClassName' => 'AccountContactAffiliationsModule',
107  'viewClassName' => 'AccountContactAffiliationEditAndDetailsView'));
108  $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit');
109  $this->setGetArray(array('moduleClassName' => 'AccountContactAffiliationsModule',
110  'viewClassName' => 'AccountAffiliationsForContactRelatedListView'));
111  $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit');
112  $this->setGetArray(array('moduleClassName' => 'AccountContactAffiliationsModule',
113  'viewClassName' => 'ContactAffiliationsForAccountRelatedListView'));
114  $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit');
115  }
116 
121  {
122  $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
123 
124  //Test create field list.
125  $this->resetPostArray();
126  $this->setGetArray(array('moduleClassName' => 'AccountContactAffiliationsModule'));
127 
128  //View creation screen, then create custom field for each custom field type.
129  $this->createCheckBoxCustomFieldByModule ('AccountContactAffiliationsModule', 'checkbox');
130  $this->createDecimalCustomFieldByModule ('AccountContactAffiliationsModule', 'decimal');
131  $this->createDropDownCustomFieldByModule ('AccountContactAffiliationsModule', 'picklist');
132  $this->createDependentDropDownCustomFieldByModule ('AccountContactAffiliationsModule', 'countrylist');
133  $this->createDependentDropDownCustomFieldByModule ('AccountContactAffiliationsModule', 'statelist');
134  $this->createDependentDropDownCustomFieldByModule ('AccountContactAffiliationsModule', 'citylist');
135  $this->createMultiSelectDropDownCustomFieldByModule ('AccountContactAffiliationsModule', 'multiselect');
136  $this->createTagCloudCustomFieldByModule ('AccountContactAffiliationsModule', 'tagcloud');
137  $this->createDropDownDependencyCustomFieldByModule ('AccountContactAffiliationsModule', 'dropdowndep');
138  $this->createDropDownDependencyCustomFieldByModule ('AccountContactAffiliationsModule', 'dropdowndep2');
139  $this->createIntegerCustomFieldByModule ('AccountContactAffiliationsModule', 'integer');
140  $this->createPhoneCustomFieldByModule ('AccountContactAffiliationsModule', 'phone');
141  $this->createRadioDropDownCustomFieldByModule ('AccountContactAffiliationsModule', 'radio');
142  $this->createTextCustomFieldByModule ('AccountContactAffiliationsModule', 'text');
143  $this->createTextAreaCustomFieldByModule ('AccountContactAffiliationsModule', 'textarea');
144  $this->createUrlCustomFieldByModule ('AccountContactAffiliationsModule', 'url');
145  }
146 
151  {
152  $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
153 
154  //Add custom fields to AccountContactAffiliationEditAndDetailsView.
155  $this->setGetArray(array('moduleClassName' => 'AccountContactAffiliationsModule',
156  'viewClassName' => 'AccountContactAffiliationEditAndDetailsView'));
157  $layout = AccountContactAffiliationsDesignerWalkthroughHelperUtil::getAccountContactAffiliationEditAndDetailsViewLayoutWithAllCustomFieldsPlaced();
158  $this->setPostArray(array('save' => 'Save', 'layout' => $layout,
159  'LayoutPanelsTypeForm' => array('type' => FormLayout::PANELS_DISPLAY_TYPE_ALL)));
160  $content = $this->runControllerWithExitExceptionAndGetContent('designer/default/LayoutEdit');
161  $this->assertContains('Layout saved successfully', $content);
162 
163  //Add all fields to ContactAffiliationsForAccountRelatedListView.
164  $this->setGetArray(array('moduleClassName' => 'AccountContactAffiliationsModule',
165  'viewClassName' => 'ContactAffiliationsForAccountRelatedListView'));
167  $this->setPostArray(array('save' => 'Save', 'layout' => $layout));
168  $content = $this->runControllerWithExitExceptionAndGetContent('designer/default/LayoutEdit');
169  $this->assertContains('Layout saved successfully', $content);
170 
171  //Add all fields to AccountAffiliationsForContactRelatedListView.
172  $this->setGetArray(array('moduleClassName' => 'AccountContactAffiliationsModule',
173  'viewClassName' => 'AccountAffiliationsForContactRelatedListView'));
175  $this->setPostArray(array('save' => 'Save', 'layout' => $layout));
176  $content = $this->runControllerWithExitExceptionAndGetContent('designer/default/LayoutEdit');
177  $this->assertContains('Layout saved successfully', $content);
178  }
179 
184  {
185  $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
186 
187  //Load create, edit views.
188  $this->runControllerWithNoExceptionsAndGetContent('accountContactAffiliations/default/create');
189  $accountContactAffiliation = AccountContactAffiliation::getAll();
190  $this->assertEquals(0, count($accountContactAffiliation));
191 
192  //Create a new AccountContactAffiliation from a related account.
193  $this->setGetArray(array( 'relationAttributeName' => 'account',
194  'relationModelId' => self::$account->id,
195  'relationModuleId' => 'accounts',
196  'redirectUrl' => 'someRedirect'));
197  $this->setPostArray(array('AccountContactAffiliation' => array(
198  'role' => array('value' => 'TechnicalX'),
199  'contact' => array('id' => self::$contact->id))));
200  $this->runControllerWithRedirectExceptionAndGetContent('accountContactAffiliations/default/createFromRelation');
201 
202  $accountContactAffiliation = AccountContactAffiliation::getAll();
203  $this->assertEquals(1, count($accountContactAffiliation));
204  $this->setGetArray(array('id' => $accountContactAffiliation[0]->id));
205  $this->runControllerWithRedirectExceptionAndGetContent('accountContactAffiliations/default/edit');
206  }
207  }
208 ?>
static getByUsername($username)
Definition: User.php:49
runControllerWithRedirectExceptionAndGetContent($route, $compareUrl=null, $compareUrlContains=false)
logoutCurrentUserLoginNewUserAndGetByUsername($username)
runControllerWithNoExceptionsAndGetContent($route, $empty=false)
static getAll($orderBy=null, $sortDescending=false, $modelClassName=null)
Generated on Sat Jul 4 2020 07:10:29
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.