public function testGetSetAuthor() { $object = new Comment(); $oStub = $this->getMock('PhpOffice\\PhpPresentation\\Shape\\Comment\\Author'); $this->assertNull($object->getAuthor()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Comment', $object->setAuthor($oStub)); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Comment\\Author', $object->getAuthor()); }
public function testCommentsAuthors() { $oAuthor = new Comment\Author(); $oComment = new Comment(); $oComment->setAuthor($oAuthor); $oPhpPresentation = new PhpPresentation(); $oPhpPresentation->getActiveSlide()->addShape($oComment); $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $this->assertTrue($pres->elementExists('/Relationships/Relationship[@Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors"]', 'ppt/_rels/presentation.xml.rels')); }
public function testComments() { $expectedElement = '/p:cmLst/p:cm'; $oAuthor = new Comment\Author(); $oComment = new Comment(); $oComment->setAuthor($oAuthor); $this->oPresentation->getActiveSlide()->addShape($oComment); $pres = TestHelperDOCX::getDocument($this->oPresentation, 'PowerPoint2007'); $this->assertTrue($pres->fileExists('ppt/comments/comment1.xml')); $this->assertTrue($pres->elementExists($expectedElement, 'ppt/comments/comment1.xml')); $this->assertEquals(0, $pres->getElementAttribute($expectedElement, 'authorId', 'ppt/comments/comment1.xml')); }
public function testWithSameAuthor() { $expectedElement = '/p:cmAuthorLst/p:cmAuthor'; $oAuthor = new Comment\Author(); $oComment1 = new Comment(); $oComment1->setAuthor($oAuthor); $this->oPresentation->getActiveSlide()->addShape($oComment1); $oComment2 = new Comment(); $oComment2->setAuthor($oAuthor); $this->oPresentation->getActiveSlide()->addShape($oComment2); $pres = TestHelperDOCX::getDocument($this->oPresentation, 'PowerPoint2007'); $this->assertTrue($pres->fileExists('ppt/commentAuthors.xml')); $this->assertTrue($pres->fileExists('ppt/commentAuthors.xml')); $this->assertTrue($pres->elementExists($expectedElement, 'ppt/commentAuthors.xml')); $this->assertEquals(1, $pres->elementCount($expectedElement, 'ppt/commentAuthors.xml')); }
public function testComment() { $expectedName = 'Name'; $expectedText = 'Text'; $oAuthor = new Comment\Author(); $oAuthor->setName($expectedName); $oComment = new Comment(); $oComment->setAuthor($oAuthor); $oComment->setText($expectedText); $this->oPresentation->getActiveSlide()->addShape($oComment); $pres = TestHelperDOCX::getDocument($this->oPresentation, 'ODPresentation'); $element = '/office:document-content'; $this->assertTrue($pres->elementExists($element, 'content.xml')); $this->assertTrue($pres->attributeElementExists($element, 'xmlns:officeooo', 'content.xml')); $element = '/office:document-content/office:body/office:presentation/draw:page/officeooo:annotation'; $this->assertTrue($pres->elementExists($element, 'content.xml')); $element = '/office:document-content/office:body/office:presentation/draw:page/officeooo:annotation/dc:creator'; $this->assertTrue($pres->elementExists($element, 'content.xml')); $this->assertEquals($expectedName, $pres->getElement($element, 'content.xml')->nodeValue); $element = '/office:document-content/office:body/office:presentation/draw:page/officeooo:annotation/text:p'; $this->assertTrue($pres->elementExists($element, 'content.xml')); $this->assertEquals($expectedText, $pres->getElement($element, 'content.xml')->nodeValue); }