public function testKanbanViewForContactDetails()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $superContactId = self::getModelIdByModelNameAndName('Contact', 'superContact superContactson');
     $contact = Contact::getById($superContactId);
     $task = TaskTestHelper::createTaskWithOwnerAndRelatedItem('MyTask', $super, $contact, Task::STATUS_IN_PROGRESS);
     $taskNew = TaskTestHelper::createTaskWithOwnerAndRelatedItem('MyTask New', $super, $contact, Task::STATUS_NEW);
     $this->setGetArray(array('id' => $task->id, 'kanbanBoard' => '1'));
     $content = $this->runControllerWithNoExceptionsAndGetContent('contacts/default/details');
     $matcher = array('tag' => 'h4', 'ancestor' => array('tag' => 'li', 'id' => 'items_' . $task->id, 'tag' => 'ul', 'id' => 'task-sortable-rows-3'), 'content' => 'MyTask');
     $this->assertTag($matcher, $content);
     $matcher = array('tag' => 'h4', 'ancestor' => array('tag' => 'li', 'id' => 'items_' . $taskNew->id, 'tag' => 'ul', 'id' => 'task-sortable-rows-1'), 'content' => 'MyTask New');
     $this->assertTag($matcher, $content);
 }
 public function testSuperUserSearchForDuplicateModelsAction()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $this->setGetArray(array('attribute' => 'lastName', 'value' => 'fakeValue'));
     $this->runControllerWithNoExceptionsAndGetContent('leads/default/searchForDuplicateModels', true);
     $contact = LeadTestHelper::createLeadbyNameForOwner('test', $super);
     TaskTestHelper::createTaskWithOwnerAndRelatedItem('task for test', $super, $contact);
     //Test search by lastName
     $this->setGetArray(array('attribute' => 'lastName', 'value' => 'testson'));
     $content = $this->runControllerWithNoExceptionsAndGetContent('leads/default/searchForDuplicateModels');
     $object = json_decode($content);
     $this->assertEquals('There is 1 possible match. <span class="underline">Click here</span> to view.', $object->message);
     $this->assertContains('CreateModelsToMergeListAndChartView', $object->content);
     //The dupe contact has one task
     $this->assertTag(array('tag' => 'span', 'attributes' => array('class' => 'total-tasks'), 'descendant' => array('tag' => 'strong', 'content' => '1')), $object->content);
     //Test search by phone
     $contact->mobilePhone = '123456789';
     $this->assertTrue($contact->save());
     $this->setGetArray(array('attribute' => 'officePhone', 'value' => '123456789'));
     $content = $this->runControllerWithNoExceptionsAndGetContent('leads/default/searchForDuplicateModels');
     $object = json_decode($content);
     $this->assertEquals('There is 1 possible match. <span class="underline">Click here</span> to view.', $object->message);
     $this->assertContains('CreateModelsToMergeListAndChartView', $object->content);
     //Test search by email
     $contact->secondaryEmail->emailAddress = 'a@a.a';
     $this->assertTrue($contact->save());
     $this->setGetArray(array('attribute' => 'primaryEmail', 'value' => 'a@a.a'));
     $content = $this->runControllerWithNoExceptionsAndGetContent('leads/default/searchForDuplicateModels');
     $object = json_decode($content);
     $this->assertEquals('There is 1 possible match. <span class="underline">Click here</span> to view.', $object->message);
     $this->assertContains('CreateModelsToMergeListAndChartView', $object->content);
 }
 public function testKanbanViewForOpportunityDetails()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $opportunities = Opportunity::getByName('superOpp');
     $task = TaskTestHelper::createTaskWithOwnerAndRelatedItem('MyTask', $super, $opportunities[0], Task::STATUS_IN_PROGRESS);
     $taskNew = TaskTestHelper::createTaskWithOwnerAndRelatedItem('MyTask New', $super, $opportunities[0], Task::STATUS_NEW);
     $this->setGetArray(array('id' => $task->id, 'kanbanBoard' => '1'));
     $content = $this->runControllerWithNoExceptionsAndGetContent('opportunities/default/details');
     $matcher = array('tag' => 'h4', 'ancestor' => array('tag' => 'li', 'id' => 'items_' . $task->id, 'tag' => 'ul', 'id' => 'task-sortable-rows-3'), 'content' => 'MyTask');
     $this->assertTag($matcher, $content);
     $matcher = array('tag' => 'h4', 'ancestor' => array('tag' => 'li', 'id' => 'items_' . $taskNew->id, 'tag' => 'ul', 'id' => 'task-sortable-rows-1'), 'content' => 'MyTask New');
     $this->assertTag($matcher, $content);
 }