PHPWord/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php

52 lines
1.8 KiB
PHP
Raw Normal View History

2014-03-14 04:26:50 +07:00
<?php
2014-03-27 23:55:06 +07: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
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
/**
* @coversNothing
2014-03-14 04:26:50 +07:00
* @runTestsInSeparateProcesses
*/
class FootnotesTest extends \PHPUnit_Framework_TestCase
2014-03-14 04:26:50 +07:00
{
public function tearDown()
{
TestHelperDOCX::clear();
}
public function testWriteFootnotes()
{
$phpWord = new PhpWord();
2015-10-10 19:22:19 +04:00
$phpWord->addParagraphStyle('pStyle', array('alignment' => Jc::START));
$section = $phpWord->addSection();
2016-06-04 20:06:37 +04:00
$section->addText('Text');
$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();
$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');
$doc = TestHelperDOCX::getDocument($phpWord);
2014-03-14 04:26:50 +07: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
}
}