PHPWord/tests/PhpWord/Tests/Section/ListItemTest.php

62 lines
1.4 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;
2014-03-09 19:09:22 +01:00
use PhpOffice\PhpWord\Section\ListItem;
2014-03-09 19:09:22 +01:00
2014-03-27 23:55:06 +07:00
/**
* Test class for PhpOffice\PhpWord\Section\ListItem
*
* @coversDefaultClass \PhpOffice\PhpWord\Section\ListItem
* @runTestsInSeparateProcesses
*/
2014-03-09 15:04:23 -04:00
class ListItemTest extends \PHPUnit_Framework_TestCase
{
2014-03-30 14:15:23 +07:00
/**
* Get text object
*/
2014-03-09 15:04:23 -04:00
public function testText()
{
$oListItem = new ListItem('text');
2014-03-09 19:09:22 +01:00
$this->assertInstanceOf('PhpOffice\\PhpWord\\Section\\Text', $oListItem->getTextObject());
2014-03-09 15:04:23 -04:00
}
2014-03-09 19:09:22 +01:00
2014-03-30 14:15:23 +07:00
/**
* Get style
*/
2014-03-09 15:04:23 -04:00
public function testStyle()
{
$oListItem = new ListItem(
'text',
1,
null,
array('listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER)
);
2014-03-09 19:09:22 +01:00
$this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\ListItem', $oListItem->getStyle());
$this->assertEquals(
$oListItem->getStyle()->getListType(),
\PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER
);
2014-03-09 15:04:23 -04:00
}
2014-03-09 19:09:22 +01:00
2014-03-30 14:15:23 +07:00
/**
* Get depth
*/
2014-03-09 15:04:23 -04:00
public function testDepth()
{
$iVal = rand(1, 1000);
$oListItem = new ListItem('text', $iVal);
2014-03-09 19:09:22 +01:00
2014-03-09 15:04:23 -04:00
$this->assertEquals($oListItem->getDepth(), $iVal);
}
}