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
|
2014-05-04 17:55:54 +07:00
|
|
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL
|
2014-03-27 23:55:06 +07:00
|
|
|
*/
|
|
|
|
|
|
2014-03-31 01:13:02 +07:00
|
|
|
namespace PhpOffice\PhpWord\Tests\Element;
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-31 01:13:02 +07:00
|
|
|
use PhpOffice\PhpWord\Element\ListItem;
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-27 23:55:06 +07:00
|
|
|
/**
|
2014-03-31 01:13:02 +07:00
|
|
|
* Test class for PhpOffice\PhpWord\Element\ListItem
|
2014-03-27 23:55:06 +07:00
|
|
|
*
|
2014-03-31 01:13:02 +07:00
|
|
|
* @coversDefaultClass \PhpOffice\PhpWord\Element\ListItem
|
2014-03-27 23:55:06 +07:00
|
|
|
* @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()
|
|
|
|
|
{
|
2014-03-18 17:26:03 +04:00
|
|
|
$oListItem = new ListItem('text');
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-31 01:13:02 +07:00
|
|
|
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\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()
|
|
|
|
|
{
|
2014-03-18 17:26:03 +04:00
|
|
|
$oListItem = new ListItem(
|
2014-03-12 13:30:02 +07:00
|
|
|
'text',
|
|
|
|
|
1,
|
|
|
|
|
null,
|
2014-03-23 10:32:08 +04:00
|
|
|
array('listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER)
|
2014-03-12 13:30:02 +07:00
|
|
|
);
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-18 17:26:03 +04:00
|
|
|
$this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\ListItem', $oListItem->getStyle());
|
|
|
|
|
$this->assertEquals(
|
|
|
|
|
$oListItem->getStyle()->getListType(),
|
2014-03-23 17:37:26 +07:00
|
|
|
\PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER
|
2014-03-18 17:26:03 +04:00
|
|
|
);
|
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);
|
2014-03-18 17:26:03 +04:00
|
|
|
$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);
|
|
|
|
|
}
|
2014-03-23 17:37:26 +07:00
|
|
|
}
|