/** * Wraps media services entity with Atom entry * * @param object $entity Media services entity * @param array $links AtomLinks to other media services entities * * @return XML string representing Atom Entry */ protected function wrapAtomEntry($entity, $links = null) { Validate::notNull($entity, 'entity'); $content = new Content(); $content->setType(Resources::XML_CONTENT_TYPE); $content->setText(ContentPropertiesSerializer::serialize($entity)); $atomEntry = new Entry(); $atomEntry->setContent($content); if ($links) { Validate::isArray($links, 'links'); $atomEntry->setLink($links); } $xmlWriter = new \XMLWriter(); $xmlWriter->openMemory(); $atomEntry->writeXml($xmlWriter); return $xmlWriter->outputMemory(); }
/** * @covers WindowsAzure\Common\Internal\Atom\Entry::getLink * @covers WindowsAzure\Common\Internal\Atom\Entry::setLink */ public function testGetSetLink() { // Setup $expected = 'testLink'; $entry = new Entry(); // Test $entry->setLink($expected); $actual = $entry->getLink(); // Assert $this->assertEquals($expected, $actual); }