/** * Writes an XML string representing the rule info instance. * * @param XMLWriter $xmlWriter The XML writer. * * @return none */ public function writeXml($xmlWriter) { $content = null; if (!is_null($this->_ruleDescription)) { $content = new Content(); $content->setText(XmlSerializer::objectSerialize($this->_ruleDescription, 'RuleDescription')); } $this->_entry->setContent($content); $this->_entry->writeXml($xmlWriter); }
/** * 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\Content::writeXml */ public function testWriteXml() { // Setup $expected = '<atom:content type="testType" xmlns:atom="http://www.w3.org/2005/Atom">testText</atom:content>'; $expectedContentType = 'testType'; $expectedText = 'testText'; $content = new Content(); // Test $content->setType($expectedContentType); $content->setText($expectedText); $xmlWriter = new \XMLWriter(); $xmlWriter->openMemory(); $content->writeXml($xmlWriter); $actual = $xmlWriter->outputMemory(); // Assert $this->assertEquals($expected, $actual); }
/** * Returns a XML string based on ATOM ENTRY schema. * * @param \XMLWriter $xmlWriter The XML writer. * * @return none */ public function writeXml($xmlWriter) { $content = null; if (!is_null($this->_queueDescription)) { $content = new Content(); $content->setText(XmlSerializer::objectSerialize($this->_queueDescription, 'QueueDescription')); $content->setType(Resources::XML_CONTENT_TYPE); } $this->_entry->setContent($content); $this->_entry->writeXml($xmlWriter); }
/** * @covers WindowsAzure\Common\Internal\Atom\Entry::getContent * @covers WindowsAzure\Common\Internal\Atom\Entry::setContent */ public function testEntryGetSetContent() { // Setup $expected = new Content(); $expected->setText('testText'); $entry = new Entry(); // Test $entry->setContent($expected); $actual = $entry->getContent(); // Assert $this->assertEquals($expected->getText(), $actual->getText()); }