Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
AccountAccountAffiliationsDesignerSuperUserWalkthroughTest.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 $account2;
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::$account2 = AccountTestHelper::createAccountByNameForOwner('superAccount2', $super);
65  }
66 
67  public function testSuperUserAccountAccountAffiliationDefaultControllerActions()
68  {
69  $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
70  //Default Controller actions requiring some sort of parameter via POST or GET
71  //Load AccountAccountAffiliation Modules Menu.
72  $this->resetPostArray();
73  $this->setGetArray(array('moduleClassName' => 'AccountAccountAffiliationsModule'));
74  $this->runControllerWithNoExceptionsAndGetContent('designer/default/modulesMenu');
75 
76  //Load AttributesList for AccountAccountAffiliation module.
77  $this->resetPostArray();
78  $this->setGetArray(array('moduleClassName' => 'AccountAccountAffiliationsModule'));
79  $this->runControllerWithNoExceptionsAndGetContent('designer/default/attributesList');
80 
81  //Load ModuleLayoutsList for AccountAccountAffiliation module.
82  $this->resetPostArray();
83  $this->setGetArray(array('moduleClassName' => 'AccountAccountAffiliationsModule'));
84  $this->runControllerWithNoExceptionsAndGetContent('designer/default/moduleLayoutsList');
85 
86  //Load ModuleEdit view for each applicable module.
87  $this->resetPostArray();
88  $this->setGetArray(array('moduleClassName' => 'AccountAccountAffiliationsModule'));
89  $this->runControllerWithNoExceptionsAndGetContent('designer/default/moduleEdit');
90 
91  //Now validate save with failed validation.
92  $this->setGetArray(array('moduleClassName' => 'AccountAccountAffiliationsModule'));
93  $this->setPostArray(array('ajax' => 'edit-form',
94  'AccountAccountAffiliationsModuleForm' => $this->createModuleEditBadValidationPostData()));
95  $content = $this->runControllerWithExitExceptionAndGetContent('designer/default/moduleEdit');
96 
97  //Now validate save with successful validation.
98  $this->setGetArray(array('moduleClassName' => 'AccountAccountAffiliationsModule'));
99  $this->setPostArray(array('ajax' => 'edit-form',
100  'AccountAccountAffiliationsModuleForm' => $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' => 'AccountAccountAffiliationsModule',
107  'viewClassName' => 'AccountAccountAffiliationEditAndDetailsView'));
108  $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit');
109  $this->setGetArray(array('moduleClassName' => 'AccountAccountAffiliationsModule',
110  'viewClassName' => 'AccountAccountAffiliationsRelatedListView'));
111  $this->runControllerWithNoExceptionsAndGetContent('designer/default/LayoutEdit');
112  }
113 
118  {
119  $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
120 
121  //Test create field list.
122  $this->resetPostArray();
123  $this->setGetArray(array('moduleClassName' => 'AccountAccountAffiliationsModule'));
124 
125  //View creation screen, then create custom field for each custom field type.
126  $this->createCheckBoxCustomFieldByModule ('AccountAccountAffiliationsModule', 'checkbox');
127  $this->createDecimalCustomFieldByModule ('AccountAccountAffiliationsModule', 'decimal');
128  $this->createDropDownCustomFieldByModule ('AccountAccountAffiliationsModule', 'picklist');
129  $this->createDependentDropDownCustomFieldByModule ('AccountAccountAffiliationsModule', 'countrylist');
130  $this->createDependentDropDownCustomFieldByModule ('AccountAccountAffiliationsModule', 'statelist');
131  $this->createDependentDropDownCustomFieldByModule ('AccountAccountAffiliationsModule', 'citylist');
132  $this->createMultiSelectDropDownCustomFieldByModule ('AccountAccountAffiliationsModule', 'multiselect');
133  $this->createTagCloudCustomFieldByModule ('AccountAccountAffiliationsModule', 'tagcloud');
134  $this->createDropDownDependencyCustomFieldByModule ('AccountAccountAffiliationsModule', 'dropdowndep');
135  $this->createDropDownDependencyCustomFieldByModule ('AccountAccountAffiliationsModule', 'dropdowndep2');
136  $this->createIntegerCustomFieldByModule ('AccountAccountAffiliationsModule', 'integer');
137  $this->createPhoneCustomFieldByModule ('AccountAccountAffiliationsModule', 'phone');
138  $this->createRadioDropDownCustomFieldByModule ('AccountAccountAffiliationsModule', 'radio');
139  $this->createTextCustomFieldByModule ('AccountAccountAffiliationsModule', 'text');
140  $this->createTextAreaCustomFieldByModule ('AccountAccountAffiliationsModule', 'textarea');
141  $this->createUrlCustomFieldByModule ('AccountAccountAffiliationsModule', 'url');
142  }
143 
148  {
149  $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
150 
151  //Add custom fields to AccountAccountAffiliationEditAndDetailsView.
152  $this->setGetArray(array('moduleClassName' => 'AccountAccountAffiliationsModule',
153  'viewClassName' => 'AccountAccountAffiliationEditAndDetailsView'));
154  $layout = AccountAccountAffiliationsDesignerWalkthroughHelperUtil::getAccountAccountAffiliationEditAndDetailsViewLayoutWithAllCustomFieldsPlaced();
155  $this->setPostArray(array('save' => 'Save', 'layout' => $layout,
156  'LayoutPanelsTypeForm' => array('type' => FormLayout::PANELS_DISPLAY_TYPE_ALL)));
157  $content = $this->runControllerWithExitExceptionAndGetContent('designer/default/LayoutEdit');
158  $this->assertContains('Layout saved successfully', $content);
159 
160  //Add all fields to AccountsRelatedListView.
161  $this->setGetArray(array('moduleClassName' => 'AccountsModule',
162  'viewClassName' => 'AccountsRelatedListView'));
164  $this->setPostArray(array('save' => 'Save', 'layout' => $layout));
165  $content = $this->runControllerWithExitExceptionAndGetContent('designer/default/LayoutEdit');
166  $this->assertContains('Layout saved successfully', $content);
167  }
168 
173  {
174  $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
175  //Load create, edit views.
176  $this->runControllerWithNoExceptionsAndGetContent('accountAccountAffiliations/default/create');
177  $accountAccountAffiliations = AccountAccountAffiliation::getAll();
178  $this->assertEquals(0, count($accountAccountAffiliations));
179 
180  //Create a new AccountAccountAffiliation from a related account.
181  $this->setGetArray(array( 'relationAttributeName' => 'primaryAccount',
182  'relationModelId' => self::$account2->id,
183  'relationModuleId' => 'accounts',
184  'redirectUrl' => 'someRedirect'));
185  $this->setPostArray(array('AccountAccountAffiliation' => array(
186  'secondaryAccount' => array('id' => self::$account->id))));
187  $this->runControllerWithRedirectExceptionAndGetContent('accountAccountAffiliations/default/createFromRelation');
188 
189  $accountAccountAffiliations = AccountAccountAffiliation::getAll();
190  $this->assertEquals(1, count($accountAccountAffiliations));
191  $this->setGetArray(array('id' => $accountAccountAffiliations[0]->id));
192  $this->runControllerWithRedirectExceptionAndGetContent('accountAccountAffiliations/default/edit');
193  }
194  }
195 ?>
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 Fri Jul 10 2020 07:10:29
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.