PHPWord/Tests/PHPWord/Section/TitleTest.php
2014-03-11 21:44:54 +07:00

49 lines
1.2 KiB
PHP

<?php
namespace PHPWord\Tests\Section;
use PHPUnit_Framework_TestCase;
use PHPWord_Section_Title;
class TitleTest extends \PHPUnit_Framework_TestCase
{
public function testConstruct()
{
$oTitle = new PHPWord_Section_Title('text');
$this->assertInstanceOf('PHPWord_Section_Title', $oTitle);
$this->assertEquals($oTitle->getText(), 'text');
}
public function testStyleNull()
{
$oTitle = new PHPWord_Section_Title('text');
$this->assertEquals($oTitle->getStyle(), null);
}
public function testStyleNotNull()
{
$oTitle = new PHPWord_Section_Title('text', 1, 'style');
$this->assertEquals($oTitle->getStyle(), 'style');
}
public function testAnchor()
{
$oTitle = new PHPWord_Section_Title('text');
$iVal = rand(1, 1000);
$oTitle->setAnchor($iVal);
$this->assertEquals($oTitle->getAnchor(), $iVal);
}
public function testBookmarkID()
{
$oTitle = new PHPWord_Section_Title('text');
$iVal = rand(1, 1000);
$oTitle->setBookmarkId($iVal);
$this->assertEquals($oTitle->getBookmarkId(), $iVal);
}
}