Additional template test
This commit is contained in:
parent
077d87d1bc
commit
18c1e5f77b
@ -145,17 +145,43 @@ final class TemplateTest extends \PHPUnit_Framework_TestCase
|
|||||||
@$template->applyXslStyleSheet($xslDOMDocument);
|
@$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 ::setValue
|
||||||
* @covers ::getVariables
|
* @covers ::getVariables
|
||||||
* @covers ::cloneRow
|
* @covers ::cloneRow
|
||||||
* @covers ::saveAs
|
* @covers ::saveAs
|
||||||
*/
|
*/
|
||||||
public function testCloneRow()
|
public function testCloneMergedRow()
|
||||||
{
|
{
|
||||||
$template = \join(
|
$template = \join(
|
||||||
\DIRECTORY_SEPARATOR,
|
\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');
|
$expectedVar = array('tableHeader', 'userId', 'userName', 'userLocation');
|
||||||
$docName = 'clone-test-result.docx';
|
$docName = 'clone-test-result.docx';
|
||||||
|
|||||||
BIN
Tests/_files/templates/clone-merge.docx
Normal file
BIN
Tests/_files/templates/clone-merge.docx
Normal file
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user