Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
LeadsSuperUserKanbanBoardWalkthroughTest.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 
41  {
42  public static function setUpBeforeClass()
43  {
44  parent::setUpBeforeClass();
45  SecurityTestHelper::createSuperAdmin();
46  $super = User::getByUsername('super');
47  Yii::app()->user->userModel = $super;
48 
49  //Setup test data owned by the super user.
50  LeadTestHelper::createLeadbyNameForOwner('superLead', $super);
51  LeadTestHelper::createLeadbyNameForOwner('superLead1', $super);
52  }
53 
54  public function testKanbanViewForOpportunityDetails()
55  {
56  $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
57  $superLeadId = self::getModelIdByModelNameAndName('Contact', 'superLead superLeadson');
58  $lead = Contact::getById($superLeadId);
59 
60  $task = TaskTestHelper::createTaskWithOwnerAndRelatedItem('MyTask', $super, $lead, Task::STATUS_IN_PROGRESS);
61  $taskNew = TaskTestHelper::createTaskWithOwnerAndRelatedItem('MyTask New', $super, $lead, Task::STATUS_NEW);
62  $this->setGetArray(array('id' => $task->id, 'kanbanBoard' => '1'));
63  $content = $this->runControllerWithNoExceptionsAndGetContent('leads/default/details');
64  $matcher = array(
65  'tag' => 'h4',
66  //Multiple ancestors
67  'ancestor' => array('tag' => 'li', 'id' => 'items_' . $task->id, 'tag' => 'ul', 'id' => 'task-sortable-rows-3'),
68  'content' => 'MyTask'
69  );
70  $this->assertTag($matcher, $content);
71 
72  $matcher = array(
73  'tag' => 'h4',
74  //Multiple ancestors
75  'ancestor' => array('tag' => 'li', 'id' => 'items_' . $taskNew->id, 'tag' => 'ul', 'id' => 'task-sortable-rows-1'),
76  'content' => 'MyTask New'
77  );
78  $this->assertTag($matcher, $content);
79  }
80 
81  public function testStickySearchActions()
82  {
83  $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
84  StickySearchUtil::clearDataByKey('TasksForRelatedKanbanSearchView');
85  $value = StickySearchUtil::getDataByKey('TasksForRelatedKanbanSearchView');
86  $this->assertNull($value);
87  $superLeadId = self::getModelIdByModelNameAndName ('Contact', 'superLead1 superLead1son');
88  $lead = Contact::getById($superLeadId);
89  $task = TaskTestHelper::createTaskWithOwnerAndRelatedItem('MyTask', $super, $lead, Task::STATUS_IN_PROGRESS);
90  $taskNew = TaskTestHelper::createTaskWithOwnerAndRelatedItem('MyTask New', $super, $lead, Task::STATUS_NEW);
91  // Asserting the kanban board contains both tasks before search
92  $this->resetPostArray();
93  $this->setGetArray(array(
94  'id' => $superLeadId,
95  'kanbanBoard' => '1',
96  ));
97  $content = $this->runControllerWithNoExceptionsAndGetContent('leads/default/details');
98  $this->assertContains('<a id="hide-completed-search-link" href="#">Hide Completed</a>', $content);
99  $matcher = array(
100  'tag' => 'h4',
101  //Multiple ancestors
102  'ancestor' => array('tag' => 'li', 'id' => 'items_' . $taskNew->id, 'tag' => 'ul', 'id' => 'task-sortable-rows-1'),
103  'content' => 'MyTask New'
104  );
105  $this->assertTag($matcher, $content);
106  $matcher = array(
107  'tag' => 'h4',
108  //Multiple ancestors
109  'ancestor' => array('tag' => 'li', 'id' => 'items_' . $task->id, 'tag' => 'ul', 'id' => 'task-sortable-rows-3'),
110  'content' => 'MyTask'
111  );
112  $this->assertTag($matcher, $content);
113  $this->setGetArray(array(
114  'formModelClassName' => 'TasksForRelatedKanbanSearchForm',
115  'modelClassName' => 'Task',
116  'viewClassName' => 'TasksForRelatedKanbanSearchView',
117  ));
118  $this->setPostArray(array('TasksForRelatedKanbanSearchForm' =>
119  array('dynamicClauses' => array(array('attributeIndexOrDerivedType' => 'name',
120  'name' => 'MyTask New',
121  'structurePosition' => '1',
122  )),
123  'anyMixedAttributesScope' => array('All'),
124  'dynamicStructure' => '1',
125  ),
126  'ajax' => 'search-form'));
127 
128  $content = $this->runControllerWithNoExceptionsAndGetContent('zurmo/default/validateDynamicSearch', true);
129  // Asserting the kanban board contains only one task after search is done
130  $this->resetPostArray();
131  $this->setGetArray(array(
132  'id' => $superLeadId,
133  'kanbanBoard' => '1',
134  ));
135  $content = $this->runControllerWithNoExceptionsAndGetContent('leads/default/details');
136  $this->assertContains('<a id="hide-completed-search-link" href="#">Hide Completed</a>', $content);
137  $matcher = array(
138  'tag' => 'h4',
139  //Multiple ancestors
140  'ancestor' => array('tag' => 'li', 'id' => 'items_' . $taskNew->id, 'tag' => 'ul', 'id' => 'task-sortable-rows-1'),
141  'content' => 'MyTask New'
142  );
143  $this->assertTag($matcher, $content);
144  $matcher = array(
145  'tag' => 'h4',
146  //Multiple ancestors
147  'ancestor' => array('tag' => 'li', 'id' => 'items_' . $task->id, 'tag' => 'ul', 'id' => 'task-sortable-rows-3'),
148  'content' => 'MyTask'
149  );
150  $this->assertNotTag($matcher, $content);
151  $data = StickySearchUtil::getDataByKey('TasksForRelatedKanbanSearchView');
152  $compareData = array(
153  'dynamicClauses' => array(array('attributeIndexOrDerivedType' => 'name',
154  'name' => 'MyTask New',
155  'structurePosition' => '1',
156  )),
157  'dynamicStructure' => '1',
158  'anyMixedAttributesScope' => null,
159  SearchForm::SELECTED_LIST_ATTRIBUTES => null,
160  'savedSearchId' => null,
161  );
162  $this->assertEquals($compareData, $data);
163  }
164  }
165 ?>
static getByUsername($username)
Definition: User.php:49
static getById($id, $modelClassName=null)
logoutCurrentUserLoginNewUserAndGetByUsername($username)
runControllerWithNoExceptionsAndGetContent($route, $empty=false)
Generated on Sun Nov 29 2020 07:10:26
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.