PHPWord/Tests/PhpWord/Section/TitleTest.php

47 lines
1.1 KiB
PHP
Raw Normal View History

2014-03-09 19:09:22 +01:00
<?php
namespace PhpWord\Tests\Section;
2014-03-09 19:09:22 +01:00
use PhpOffice\PhpWord\Section\Title;
2014-03-09 19:09:22 +01:00
2014-03-09 15:04:23 -04:00
class TitleTest extends \PHPUnit_Framework_TestCase
{
public function testConstruct()
{
$oTitle = new Title('text');
2014-03-09 15:04:23 -04:00
$this->assertInstanceOf('PhpOffice\\PhpWord\\Section\\Title', $oTitle);
2014-03-09 15:04:23 -04:00
$this->assertEquals($oTitle->getText(), 'text');
}
public function testStyleNull()
{
$oTitle = new Title('text');
2014-03-09 15:04:23 -04:00
$this->assertEquals($oTitle->getStyle(), null);
}
public function testStyleNotNull()
{
$oTitle = new Title('text', 1, 'style');
2014-03-09 15:04:23 -04:00
$this->assertEquals($oTitle->getStyle(), 'style');
}
public function testAnchor()
{
$oTitle = new Title('text');
2014-03-09 15:04:23 -04:00
$iVal = rand(1, 1000);
$oTitle->setAnchor($iVal);
$this->assertEquals($oTitle->getAnchor(), $iVal);
}
public function testBookmarkID()
{
$oTitle = new Title('text');
2014-03-09 15:04:23 -04:00
$iVal = rand(1, 1000);
$oTitle->setBookmarkId($iVal);
$this->assertEquals($oTitle->getBookmarkId(), $iVal);
}
}