public function testLayout() { $object = new SlideMaster(); // Mock Post $mockSlideLayout = $this->getMockForAbstractClass('PhpOffice\\PhpPresentation\\Slide\\SlideLayout', array($object)); $this->assertEmpty($object->getAllSlideLayouts()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\SlideLayout', $object->createSlideLayout()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\SlideLayout', $object->addSlideLayout($mockSlideLayout)); $this->assertCount(2, $object->getAllSlideLayouts()); }
/** * Write slide master relationships to XML format * * @param SlideMaster $oMasterSlide * @return string XML Output * @throws \Exception * @internal param int $masterId Master slide id */ public function writeSlideMasterRelationships(SlideMaster $oMasterSlide) { // Create XML writer $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); // XML header $objWriter->startDocument('1.0', 'UTF-8', 'yes'); // Relationships $objWriter->startElement('Relationships'); $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); // Starting relation id $relId = 0; // Write all the relations to the Layout Slides foreach ($oMasterSlide->getAllSlideLayouts() as $slideLayout) { $this->writeRelationship($objWriter, ++$relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout', '../slideLayouts/slideLayout' . $slideLayout->layoutNr . '.xml'); // Save the used relationId $slideLayout->relationId = 'rId' . $relId; } // Write drawing relationships? $this->writeDrawingRelations($oMasterSlide, $objWriter, $relId); // TODO: Write hyperlink relationships? // TODO: Write comment relationships // Relationship theme/theme1.xml $this->writeRelationship($objWriter, ++$relId, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', '../theme/theme' . $oMasterSlide->getRelsIndex() . '.xml'); $objWriter->endElement(); // Return return $objWriter->getData(); }