addText('Test'); $phpWord = new PhpWord(); $phpWord->addComment($comment); $doc = TestHelperDOCX::getDocument($phpWord); $path = '/w:comments/w:comment'; $file = 'word/comments.xml'; $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); $this->assertNotNull($element->getAttribute('w:id')); $this->assertEquals("Authors name", $element->getAttribute('w:author')); $this->assertEquals("my_initials", $element->getAttribute('w:initials')); } }