Additional template test

This commit is contained in:
Ivan Lanin 2014-03-16 08:42:02 +07:00
parent 077d87d1bc
commit 18c1e5f77b
3 changed files with 28 additions and 2 deletions

View File

@ -145,17 +145,43 @@ final class TemplateTest extends \PHPUnit_Framework_TestCase
@$template->applyXslStyleSheet($xslDOMDocument);
}
/**
* @covers PHPWord_Template
*/
public function testConstruct()
{
$template = \join(
\DIRECTORY_SEPARATOR,
array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'templates', 'clone-row.docx')
);
$expectedVar = array('tableHeader', 'userId', 'userName');
$document = new PHPWord_Template($template);
$actualVar = $document->getVariables();
$document->cloneRow('userId', 9);
$document->setValue('userId#1', utf8_decode('ééé'));
$document->setValue('userId#2', 'a');
$document->setValue('userId#3', 'a');
$document->setValue('userId#3', 'a');
$document->setValue('userId#4', 'a');
$document->setValue('userId#5', 'a');
$document->setValue('userId#6', 'a');
$document->setValue('userId#7', 'a');
$document->setValue('userId#8', 'a');
$document->cloneRow('userId#9', 'a');
$this->assertEquals($expectedVar, $actualVar);
}
/**
* @covers ::setValue
* @covers ::getVariables
* @covers ::cloneRow
* @covers ::saveAs
*/
public function testCloneRow()
public function testCloneMergedRow()
{
$template = \join(
\DIRECTORY_SEPARATOR,
array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'templates', 'clone-row.docx')
array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'templates', 'clone-merge.docx')
);
$expectedVar = array('tableHeader', 'userId', 'userName', 'userLocation');
$docName = 'clone-test-result.docx';

Binary file not shown.