2014-03-14 04:26:50 +07:00
|
|
|
<?php
|
2014-03-27 23:55:06 +07:00
|
|
|
/**
|
|
|
|
|
* PHPWord
|
|
|
|
|
*
|
|
|
|
|
* @link https://github.com/PHPOffice/PHPWord
|
|
|
|
|
* @copyright 2014 PHPWord
|
|
|
|
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
|
|
|
|
*/
|
2014-03-23 11:59:22 -04:00
|
|
|
namespace PhpOffice\PhpWord\Tests\Writer\Word2007;
|
2014-03-14 04:26:50 +07:00
|
|
|
|
2014-03-22 10:06:08 +04:00
|
|
|
use PhpOffice\PhpWord\PhpWord;
|
2014-03-23 12:37:31 -04:00
|
|
|
use PhpOffice\PhpWord\Tests\TestHelperDOCX;
|
2014-03-14 04:26:50 +07:00
|
|
|
|
|
|
|
|
/**
|
2014-03-27 23:55:06 +07:00
|
|
|
* Test class for PhpOffice\PhpWord\Writer\Word2007\Footnotes
|
|
|
|
|
*
|
|
|
|
|
* @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Footnotes
|
2014-03-14 04:26:50 +07:00
|
|
|
* @runTestsInSeparateProcesses
|
|
|
|
|
*/
|
|
|
|
|
class FootnotesTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Executed before each method of the class
|
|
|
|
|
*/
|
|
|
|
|
public function tearDown()
|
|
|
|
|
{
|
|
|
|
|
TestHelperDOCX::clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testWriteFootnotes()
|
|
|
|
|
{
|
2014-03-20 16:54:12 +04:00
|
|
|
$phpWord = new PhpWord();
|
|
|
|
|
$section = $phpWord->createSection();
|
2014-03-14 04:26:50 +07:00
|
|
|
$section->addText('Text');
|
|
|
|
|
$footnote = $section->createFootnote();
|
|
|
|
|
$footnote->addText('Footnote');
|
|
|
|
|
$footnote->addLink('http://google.com');
|
2014-03-20 16:54:12 +04:00
|
|
|
$doc = TestHelperDOCX::getDocument($phpWord);
|
2014-03-14 04:26:50 +07:00
|
|
|
|
2014-03-14 04:39:41 +07:00
|
|
|
$this->assertTrue($doc->elementExists("/w:document/w:body/w:p/w:r/w:footnoteReference"));
|
2014-03-14 04:26:50 +07:00
|
|
|
}
|
|
|
|
|
}
|