public function testGetSetName() { $expectedVal = 'AABBCCDD'; $object = new Author(); $this->assertNull($object->getName()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Comment\\Author', $object->setName($expectedVal)); $this->assertEquals($expectedVal, $object->getName()); }
public function testComments() { $expectedElement = '/p:cmAuthorLst/p:cmAuthor'; $expectedName = 'Name'; $expectedInitials = 'Initials'; $oAuthor = new Comment\Author(); $oAuthor->setName($expectedName); $oAuthor->setInitials($expectedInitials); $oComment = new Comment(); $oComment->setAuthor($oAuthor); $this->oPresentation->getActiveSlide()->addShape($oComment); $pres = TestHelperDOCX::getDocument($this->oPresentation, 'PowerPoint2007'); $this->assertTrue($pres->fileExists('ppt/commentAuthors.xml')); $this->assertTrue($pres->elementExists($expectedElement, 'ppt/commentAuthors.xml')); $this->assertEquals(0, $pres->getElementAttribute($expectedElement, 'id', 'ppt/commentAuthors.xml')); $this->assertEquals($expectedName, $pres->getElementAttribute($expectedElement, 'name', 'ppt/commentAuthors.xml')); $this->assertEquals($expectedInitials, $pres->getElementAttribute($expectedElement, 'initials', '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); }