PHPWord/Tests/PHPWord/Style/TableTest.php
Roman Syroeshko 36c03d4f15 https://github.com/PHPOffice/PHPWord/issues/43
Redundant imports of PHPUnit_Framework_TestCase were removed.
2014-03-12 20:13:06 +04:00

52 lines
1.4 KiB
PHP

<?php
namespace PHPWord\Tests\Style;
use PHPWord_Style_Table;
/**
* Class TableTest
*
* @package PHPWord\Tests
* @runTestsInSeparateProcesses
*/
class TableTest extends \PHPUnit_Framework_TestCase
{
/**
* Test set style value
*/
public function testSetStyleValue()
{
$object = new PHPWord_Style_Table();
$parts = array('Top', 'Left', 'Right', 'Bottom');
$value = 240; // In twips
foreach ($parts as $part) {
$property = "_cellMargin{$part}";
$get = "getCellMargin{$part}";
$object->setStyleValue($property, $value);
$this->assertEquals($value, $object->$get());
}
}
/**
* Test cell margin
*/
public function testCellMargin()
{
$object = new PHPWord_Style_Table();
$parts = array('Top', 'Left', 'Right', 'Bottom');
// Set cell margin and test if each part has the same margin
// While looping, push values array to be asserted with getCellMargin
$value = 240; // In twips
foreach ($parts as $part) {
$set = "setCellMargin{$part}";
$get = "getCellMargin{$part}";
$values[] = $value;
$object->$set($value);
$this->assertEquals($value, $object->$get());
}
$this->assertEquals($values, $object->getCellMargin());
}
}