77 lines
1.6 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\Element;
2014-03-09 19:09:22 +01:00
use PhpOffice\PhpWord\Element\Title;
2014-03-09 19:09:22 +01:00
2014-03-27 23:55:06 +07:00
/**
* Test class for PhpOffice\PhpWord\Element\Title
2014-03-27 23:55:06 +07:00
*
* @coversDefaultClass \PhpOffice\PhpWord\Element\Title
2014-03-27 23:55:06 +07:00
* @runTestsInSeparateProcesses
*/
2014-03-09 15:04:23 -04:00
class TitleTest 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()
{
$oTitle = new Title('text');
2014-03-09 15:04:23 -04:00
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Title', $oTitle);
2014-03-09 15:04:23 -04:00
$this->assertEquals($oTitle->getText(), 'text');
}
2014-03-30 14:15:23 +07:00
/**
* Get style null
*/
2014-03-09 15:04:23 -04:00
public function testStyleNull()
{
$oTitle = new Title('text');
2014-03-09 15:04:23 -04:00
$this->assertEquals($oTitle->getStyle(), null);
}
2014-03-30 14:15:23 +07:00
/**
* Get style not null
*/
2014-03-09 15:04:23 -04:00
public function testStyleNotNull()
{
$oTitle = new Title('text', 1, 'style');
2014-03-09 15:04:23 -04:00
$this->assertEquals($oTitle->getStyle(), 'style');
}
2014-03-30 14:15:23 +07:00
/**
* Get anchor
*/
2014-03-09 15:04:23 -04:00
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);
}
2014-03-30 14:15:23 +07:00
/**
* Get bookmark Id
*/
2014-03-09 15:04:23 -04:00
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);
}
}