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