public function testSetElementsValues2()
 {
     $element2 = new PhotoPost();
     $element2->setPermalink('perm1');
     $element2->setUrl('url1');
     $element2->setAlt('alt1');
     $element2->setCaption('cap1');
     $element1 = new PhotoBlockElement();
     $element1->setContent($element2);
     $subElement = new VariableElement();
     $subElement->setName('photourl-500');
     $element1->addChild($subElement);
     $subElement = new VariableElement();
     $subElement->setName('photoalt');
     $element1->addChild($subElement);
     $subElement = new VariableElement();
     $subElement->setName('linkurl');
     $element1->addChild($subElement);
     $subElement = new VariableElement();
     $subElement->setName('caption');
     $element1->addChild($subElement);
     $subElement = new VariableElement();
     $subElement->setName('linkopentag');
     $element1->addChild($subElement);
     $subElement = new VariableElement();
     $subElement->setName('linkclosetag');
     $element1->addChild($subElement);
     $subElement = new LinkUrlBlockElement();
     $element1->addChild($subElement);
     $subElement = new CaptionBlockElement();
     $element1->addChild($subElement);
     $html = $element1->render();
     $this->assertEquals('url1alt1perm1cap1<a href="perm1"></a>', $html);
 }
 public function testRender()
 {
     $photos = array();
     $subElement = new PhotoPost();
     $subElement->setUrl('url1');
     $subElement->setAlt('alt1');
     $subElement->setLinkUrl('url2');
     $subElement->setCaption('cap1');
     $photos[] = $subElement;
     $element1 = new PhotosBlockElement();
     $element1->setContent($photos);
     $subElement = new VariableElement();
     $subElement->setName('photourl-500');
     $element1->addChild($subElement);
     $subElement = new VariableElement();
     $subElement->setName('photoalt');
     $element1->addChild($subElement);
     $subElement = new VariableElement();
     $subElement->setName('linkurl');
     $element1->addChild($subElement);
     $subElement = new VariableElement();
     $subElement->setName('caption');
     $element1->addChild($subElement);
     $subElement = new VariableElement();
     $subElement->setName('linkopentag');
     $element1->addChild($subElement);
     $subElement = new VariableElement();
     $subElement->setName('linkclosetag');
     $element1->addChild($subElement);
     $subElement = new LinkUrlBlockElement();
     $element1->addChild($subElement);
     $subElement = new CaptionBlockElement();
     $element1->addChild($subElement);
     $html = $element1->render();
     $this->assertEquals('url1alt1url2cap1<a href="url2"></a>', $html);
 }
예제 #3
0
 public function testSetCaption()
 {
     $post = new PhotoPost();
     $post->setCaption('cap1');
     $this->assertEquals('cap1', $post->getCaption());
 }
예제 #4
0
 private function makePhoto($post)
 {
     $postObj = new PhotoPost();
     if (isset($post['url'])) {
         $postObj->setUrl($post['url']);
     }
     if (isset($post['alt'])) {
         $postObj->setAlt($post['alt']);
     }
     if (isset($post['link'])) {
         $postObj->setLinkUrl($post['link']);
     }
     if (isset($post['caption'])) {
         $postObj->setCaption($post['caption']);
     }
     return $postObj;
 }