public function testRenderContent()
 {
     $user = new User();
     $personCardViewLayout = new PersonCardViewLayout($user);
     $this->assertContains('img class="gravatar" width="100" height="100"', $personCardViewLayout->renderContent());
     $this->assertNotContains('<span class="salutation"></span>', $personCardViewLayout->renderContent());
     $this->assertContains('<div class="address"><', $personCardViewLayout->renderContent());
     //Creating titles
     $titles = array('testTitle.');
     $customFieldData = CustomFieldData::getByName('Titles');
     $customFieldData->serializedData = serialize($titles);
     $this->assertTrue($customFieldData->save());
     //Create address
     $address = new Address();
     $address->street1 = 'testStreet';
     $user->firstName = 'test';
     $user->lastName = 'me';
     $user->title->value = 'testTitle.';
     $user->primaryAddress = $address;
     $this->assertContains('test me', $personCardViewLayout->renderContent());
     $this->assertContains('<span class="salutation">testTitle.</span>', $personCardViewLayout->renderContent());
     $this->assertContains('testStreet', $personCardViewLayout->renderContent());
     $personCardViewLayout = new PersonCardViewLayout($user);
     $dataEnhancer = $this->getMock('DataEnhancer', array('personHasBackOfCard', 'getPersonBackOfCardLabel', 'getPersonBackOfCardCloseLabel', 'getPersonBackOfCardViewContent', 'getPersonSocialNetworksViewContent', 'getPersonDemographicViewContent', 'getPersonAvatar'));
     $dataEnhancer->expects($this->once())->method('personHasBackOfCard')->with($user)->will($this->returnValue(true));
     $dataEnhancer->expects($this->once())->method('getPersonBackOfCardLabel')->will($this->returnValue('stubBackOfCardLabel'));
     $dataEnhancer->expects($this->once())->method('getPersonBackOfCardCloseLabel')->will($this->returnValue('stubGetBackOfCardCloseLabel'));
     $dataEnhancer->expects($this->once())->method('getPersonBackOfCardViewContent')->with($user)->will($this->returnValue('stubGetPersonBackOfCardViewContent'));
     $dataEnhancer->expects($this->once())->method('getPersonSocialNetworksViewContent')->with($user)->will($this->returnValue('stubGetPersonSocialNetworksViewContent'));
     $dataEnhancer->expects($this->once())->method('getPersonDemographicViewContent')->with($user)->will($this->returnValue('stubGetPersonDemographicViewContent'));
     $dataEnhancer->expects($this->once())->method('getPersonAvatar')->with($user)->will($this->returnValue('stubAvatar'));
     Yii::app()->setComponent('dataEnhancer', $dataEnhancer, false);
     $content = $personCardViewLayout->renderContent();
     $this->assertContains('<a class="toggle-back-of-card-link mini-button clearfix" href="#">', $content);
     $this->assertContains('<span class="show">stubBackOfCardLabel</span>', $content);
     $this->assertContains('<span>stubGetBackOfCardCloseLabel</span>', $content);
     $this->assertContains('<div class="back-of-card clearfix">stubGetPersonBackOfCardViewContent</div>', $content);
     $this->assertContains('<div class="social-details">stubGetPersonSocialNetworksViewContent</div>', $content);
     $this->assertContains('<div class="demographic-details">stubGetPersonDemographicViewContent</div>', $content);
     $this->assertContains('stubAvatar', $content);
 }
Exemplo n.º 2
0
 protected function makeSecondSlidingPanelContent()
 {
     $layout = new PersonCardViewLayout($this->model);
     $content = $layout->renderContent();
     return ZurmoHtml::tag('div', array('class' => 'sliding-panel business-card showing-panel', 'id' => 'businessCardView'), $content);
 }
 protected function makeSecondSlidingPanelContent()
 {
     $layout = new PersonCardViewLayout($this->model);
     $content = $layout->renderContent();
     return PersonSlidingPanelsUtil::makeSecondSlidingPanelContent((int) $this->params['portletId'], $content);
 }