PHPWord/test/PhpWord/Style/TableTest.php

49 lines
1.3 KiB
PHP

<?php
namespace PhpWord\Tests\Style;
use PhpOffice\PhpWord\Style\Table;
/**
* @runTestsInSeparateProcesses
*/
class TableTest extends \PHPUnit_Framework_TestCase
{
/**
* Test set style value
*/
public function testSetStyleValue()
{
$object = new 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 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());
}
}