Example #1
0
 public function test()
 {
     $image = new Image();
     $image->setUrl('https://example.com/img.jpg')->setTitle('Example Image')->setLink('https://example.com')->setWidth(133)->setHeight(133)->setHeight(146);
     $this->assertEquals('https://example.com/img.jpg', $image->getUrl());
     $this->assertEquals('Example Image', $image->getTitle());
     $this->assertEquals('https://example.com', $image->getLink());
     $this->assertEquals(133, $image->getWidth());
     $this->assertEquals(146, $image->getHeight());
 }
Example #2
0
 private function writeImage(\XmlWriter $writer, Image $image)
 {
     $writer->startElement('image');
     $writer->writeElement('url', $image->getUrl());
     $writer->writeElement('link', $image->getLink());
     $writer->startElement('title');
     $writer->writeCdata($image->getTitle());
     $writer->endElement();
     $writer->endElement();
 }