2014-03-14 04:26:50 +07:00
|
|
|
<?php
|
2014-03-27 23:55:06 +07:00
|
|
|
/**
|
2014-05-05 13:06:53 +04:00
|
|
|
* This file is part of PHPWord - A pure PHP library for reading and writing
|
|
|
|
|
* word processing documents.
|
|
|
|
|
*
|
|
|
|
|
* PHPWord is free software distributed under the terms of the GNU Lesser
|
|
|
|
|
* General Public License version 3 as published by the Free Software Foundation.
|
|
|
|
|
*
|
|
|
|
|
* For the full copyright and license information, please read the LICENSE
|
|
|
|
|
* file that was distributed with this source code. For the full list of
|
|
|
|
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
2014-03-27 23:55:06 +07:00
|
|
|
*
|
|
|
|
|
* @link https://github.com/PHPOffice/PHPWord
|
2016-07-31 12:35:06 +04:00
|
|
|
* @copyright 2010-2016 PHPWord contributors
|
2014-05-04 21:03:28 +04:00
|
|
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
2014-03-27 23:55:06 +07:00
|
|
|
*/
|
2015-11-15 13:33:05 +04:00
|
|
|
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
2014-03-14 04:26:50 +07:00
|
|
|
|
2014-03-22 10:06:08 +04:00
|
|
|
use PhpOffice\PhpWord\PhpWord;
|
2015-10-10 19:22:19 +04:00
|
|
|
use PhpOffice\PhpWord\SimpleType\Jc;
|
2015-11-15 13:33:05 +04:00
|
|
|
use PhpOffice\PhpWord\TestHelperDOCX;
|
2014-03-14 04:26:50 +07:00
|
|
|
|
|
|
|
|
/**
|
2016-01-23 22:19:06 +04:00
|
|
|
* @coversNothing
|
2014-03-14 04:26:50 +07:00
|
|
|
* @runTestsInSeparateProcesses
|
|
|
|
|
*/
|
2014-04-30 08:54:38 +07:00
|
|
|
class FootnotesTest extends \PHPUnit_Framework_TestCase
|
2014-03-14 04:26:50 +07:00
|
|
|
{
|
|
|
|
|
public function tearDown()
|
|
|
|
|
{
|
|
|
|
|
TestHelperDOCX::clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testWriteFootnotes()
|
|
|
|
|
{
|
2014-03-20 16:54:12 +04:00
|
|
|
$phpWord = new PhpWord();
|
2015-10-10 19:22:19 +04:00
|
|
|
$phpWord->addParagraphStyle('pStyle', array('alignment' => Jc::START));
|
2014-04-02 11:02:56 +07:00
|
|
|
$section = $phpWord->addSection();
|
2016-06-04 20:06:37 +04:00
|
|
|
$section->addText('Text');
|
2014-04-02 11:02:56 +07:00
|
|
|
$footnote1 = $section->addFootnote('pStyle');
|
2016-06-04 20:06:37 +04:00
|
|
|
$footnote1->addText('Footnote');
|
2014-03-30 11:09:14 +07:00
|
|
|
$footnote1->addTextBreak();
|
2015-02-06 22:28:31 +04:00
|
|
|
$footnote1->addLink('https://github.com/PHPOffice/PHPWord');
|
2015-10-10 19:22:19 +04:00
|
|
|
$footnote2 = $section->addEndnote(array('alignment' => Jc::START));
|
2016-06-04 20:06:37 +04:00
|
|
|
$footnote2->addText('Endnote');
|
2014-03-20 16:54:12 +04:00
|
|
|
$doc = TestHelperDOCX::getDocument($phpWord);
|
2014-03-14 04:26:50 +07:00
|
|
|
|
2015-02-06 22:28:31 +04:00
|
|
|
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:footnoteReference'));
|
|
|
|
|
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:r/w:endnoteReference'));
|
2014-03-14 04:26:50 +07:00
|
|
|
}
|
|
|
|
|
}
|