@@ -145,17 +145,43 @@ final public function testXslStyleSheetCanNotBeAppliedOnFailureOfLoadingXmlFromT
145
145
@$ template ->applyXslStyleSheet ($ xslDOMDocument );
146
146
}
147
147
148
+ /**
149
+ * @covers PHPWord_Template
150
+ */
151
+ public function testConstruct ()
152
+ {
153
+ $ template = \join (
154
+ \DIRECTORY_SEPARATOR ,
155
+ array (\PHPWORD_TESTS_DIR_ROOT , '_files ' , 'templates ' , 'clone-row.docx ' )
156
+ );
157
+ $ expectedVar = array ('tableHeader ' , 'userId ' , 'userName ' );
158
+ $ document = new PHPWord_Template ($ template );
159
+ $ actualVar = $ document ->getVariables ();
160
+ $ document ->cloneRow ('userId ' , 9 );
161
+ $ document ->setValue ('userId#1 ' , utf8_decode ('ééé ' ));
162
+ $ document ->setValue ('userId#2 ' , 'a ' );
163
+ $ document ->setValue ('userId#3 ' , 'a ' );
164
+ $ document ->setValue ('userId#3 ' , 'a ' );
165
+ $ document ->setValue ('userId#4 ' , 'a ' );
166
+ $ document ->setValue ('userId#5 ' , 'a ' );
167
+ $ document ->setValue ('userId#6 ' , 'a ' );
168
+ $ document ->setValue ('userId#7 ' , 'a ' );
169
+ $ document ->setValue ('userId#8 ' , 'a ' );
170
+ $ document ->cloneRow ('userId#9 ' , 'a ' );
171
+ $ this ->assertEquals ($ expectedVar , $ actualVar );
172
+ }
173
+
148
174
/**
149
175
* @covers ::setValue
150
176
* @covers ::getVariables
151
177
* @covers ::cloneRow
152
178
* @covers ::saveAs
153
179
*/
154
- public function testCloneRow ()
180
+ public function testCloneMergedRow ()
155
181
{
156
182
$ template = \join (
157
183
\DIRECTORY_SEPARATOR ,
158
- array (\PHPWORD_TESTS_DIR_ROOT , '_files ' , 'templates ' , 'clone-row .docx ' )
184
+ array (\PHPWORD_TESTS_DIR_ROOT , '_files ' , 'templates ' , 'clone-merge .docx ' )
159
185
);
160
186
$ expectedVar = array ('tableHeader ' , 'userId ' , 'userName ' , 'userLocation ' );
161
187
$ docName = 'clone-test-result.docx ' ;
0 commit comments