PHPWord/tests/PhpWord/Tests/Section/Footer/PreserveTextTest.php

62 lines
1.9 KiB
PHP
Raw Normal View History

2014-03-09 19:09:22 +01: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
*/
namespace PhpOffice\PhpWord\Tests\Section\Footer;
2014-03-09 19:09:22 +01:00
use PhpOffice\PhpWord\Section\Footer\PreserveText;
2014-03-09 19:09:22 +01:00
2014-03-27 23:55:06 +07:00
/**
* Test class for PhpOffice\PhpWord\Section\Footer\PreserveText
*
* @runTestsInSeparateProcesses
*/
2014-03-09 15:04:23 -04:00
class PreserveTextTest extends \PHPUnit_Framework_TestCase
{
2014-03-30 14:15:23 +07:00
/**
* Create new instance
*/
2014-03-09 15:04:23 -04:00
public function testConstruct()
{
$oPreserveText = new PreserveText();
2014-03-09 19:09:22 +01:00
$this->assertInstanceOf('PhpOffice\\PhpWord\\Section\\Footer\\PreserveText', $oPreserveText);
2014-03-09 15:04:23 -04:00
$this->assertEquals($oPreserveText->getText(), null);
$this->assertEquals($oPreserveText->getFontStyle(), null);
$this->assertEquals($oPreserveText->getParagraphStyle(), null);
}
2014-03-09 19:09:22 +01:00
2014-03-30 14:15:23 +07:00
/**
* Create new instance with style name
*/
2014-03-09 15:04:23 -04:00
public function testConstructWithString()
{
$oPreserveText = new PreserveText('text', 'styleFont', 'styleParagraph');
$this->assertEquals($oPreserveText->getText(), array('text'));
2014-03-09 15:04:23 -04:00
$this->assertEquals($oPreserveText->getFontStyle(), 'styleFont');
$this->assertEquals($oPreserveText->getParagraphStyle(), 'styleParagraph');
}
2014-03-09 19:09:22 +01:00
2014-03-30 14:15:23 +07:00
/**
* Create new instance with array
*/
2014-03-09 15:04:23 -04:00
public function testConstructWithArray()
{
$oPreserveText = new PreserveText(
'text',
array('align' => 'center'),
array('marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600)
);
$this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Font', $oPreserveText->getFontStyle());
$this->assertInstanceOf(
'PhpOffice\\PhpWord\\Style\\Paragraph',
$oPreserveText->getParagraphStyle()
);
2014-03-09 15:04:23 -04:00
}
}