2014-03-09 19:09:22 +01:00
|
|
|
<?php
|
2014-03-20 16:54:12 +04:00
|
|
|
namespace PhpWord\Tests\Section;
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-18 17:26:03 +04:00
|
|
|
use PhpOffice\PhpWord\Section\Footnote;
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-09 15:04:23 -04:00
|
|
|
class FootnoteTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
{
|
|
|
|
|
public function testConstruct()
|
|
|
|
|
{
|
2014-03-18 17:26:03 +04:00
|
|
|
$oFootnote = new Footnote();
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-18 17:26:03 +04:00
|
|
|
$this->assertInstanceOf('PhpOffice\\PhpWord\\Section\\Footnote', $oFootnote);
|
2014-03-09 15:04:23 -04:00
|
|
|
$this->assertCount(0, $oFootnote->getElements());
|
|
|
|
|
$this->assertEquals($oFootnote->getParagraphStyle(), null);
|
|
|
|
|
}
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-09 15:04:23 -04:00
|
|
|
public function testConstructString()
|
|
|
|
|
{
|
2014-03-18 17:26:03 +04:00
|
|
|
$oFootnote = new Footnote('pStyle');
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-09 15:04:23 -04:00
|
|
|
$this->assertEquals($oFootnote->getParagraphStyle(), 'pStyle');
|
|
|
|
|
}
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-09 15:04:23 -04:00
|
|
|
public function testConstructArray()
|
|
|
|
|
{
|
2014-03-18 17:26:03 +04:00
|
|
|
$oFootnote = new Footnote(array('spacing' => 100));
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-18 17:26:03 +04:00
|
|
|
$this->assertInstanceOf(
|
|
|
|
|
'PhpOffice\\PhpWord\\Style\\Paragraph',
|
|
|
|
|
$oFootnote->getParagraphStyle()
|
|
|
|
|
);
|
2014-03-09 15:04:23 -04:00
|
|
|
}
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-09 15:04:23 -04:00
|
|
|
public function testAddText()
|
|
|
|
|
{
|
2014-03-18 17:26:03 +04:00
|
|
|
$oFootnote = new Footnote();
|
2014-03-09 15:04:23 -04:00
|
|
|
$element = $oFootnote->addText('text');
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-09 15:04:23 -04:00
|
|
|
$this->assertCount(1, $oFootnote->getElements());
|
2014-03-18 17:26:03 +04:00
|
|
|
$this->assertInstanceOf('PhpOffice\\PhpWord\\Section\\Text', $element);
|
2014-03-09 15:04:23 -04:00
|
|
|
}
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-09 15:04:23 -04:00
|
|
|
public function testAddLink()
|
|
|
|
|
{
|
2014-03-18 17:26:03 +04:00
|
|
|
$oFootnote = new Footnote();
|
2014-03-09 15:04:23 -04:00
|
|
|
$element = $oFootnote->addLink('http://www.google.fr');
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-09 15:04:23 -04:00
|
|
|
$this->assertCount(1, $oFootnote->getElements());
|
2014-03-18 17:26:03 +04:00
|
|
|
$this->assertInstanceOf('PhpOffice\\PhpWord\\Section\\Link', $element);
|
2014-03-09 15:04:23 -04:00
|
|
|
}
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-09 15:04:23 -04:00
|
|
|
public function testReferenceId()
|
|
|
|
|
{
|
2014-03-18 17:26:03 +04:00
|
|
|
$oFootnote = new Footnote();
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-09 15:04:23 -04:00
|
|
|
$iVal = rand(1, 1000);
|
|
|
|
|
$oFootnote->setReferenceId($iVal);
|
|
|
|
|
$this->assertEquals($oFootnote->getReferenceId(), $iVal);
|
|
|
|
|
}
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-09 15:04:23 -04:00
|
|
|
public function testGetElements()
|
|
|
|
|
{
|
2014-03-18 17:26:03 +04:00
|
|
|
$oFootnote = new Footnote();
|
2014-03-09 15:04:23 -04:00
|
|
|
$this->assertInternalType('array', $oFootnote->getElements());
|
|
|
|
|
}
|
2014-03-11 21:44:54 +07:00
|
|
|
}
|