getElements()); self::assertNull($oFootnote->getParagraphStyle()); } /** * New instance with string parameter. */ public function testConstructString(): void { $oFootnote = new Footnote('pStyle'); self::assertEquals('pStyle', $oFootnote->getParagraphStyle()); } /** * New instance with array parameter. */ public function testConstructArray(): void { $oFootnote = new Footnote(['spacing' => 100]); self::assertInstanceOf( 'PhpOffice\\PhpWord\\Style\\Paragraph', $oFootnote->getParagraphStyle() ); } /** * Add text element. */ public function testAddText(): void { $oFootnote = new Footnote(); $element = $oFootnote->addText('text'); self::assertCount(1, $oFootnote->getElements()); self::assertInstanceOf('PhpOffice\\PhpWord\\Element\\Text', $element); } /** * Add text break element. */ public function testAddTextBreak(): void { $oFootnote = new Footnote(); $oFootnote->addTextBreak(2); self::assertCount(2, $oFootnote->getElements()); } /** * Add link element. */ public function testAddLink(): void { $oFootnote = new Footnote(); $element = $oFootnote->addLink('https://github.com/PHPOffice/PHPWord'); self::assertCount(1, $oFootnote->getElements()); self::assertInstanceOf('PhpOffice\\PhpWord\\Element\\Link', $element); } /** * Set/get reference Id. */ public function testReferenceId(): void { $oFootnote = new Footnote(); $iVal = mt_rand(1, 1000); $oFootnote->setRelationId($iVal); self::assertEquals($iVal, $oFootnote->getRelationId()); } /** * Get elements. */ public function testGetElements(): void { $oFootnote = new Footnote(); self::assertIsArray($oFootnote->getElements()); } }