Skip to content

Commit 9ffbd98

Browse files
Trainmastertroosan
authored andcommitted
Add missing tests
1 parent edc3aa3 commit 9ffbd98

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

tests/PhpWord/Writer/Word2007/Part/SettingsTest.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,22 @@ public function testEvenAndOddHeaders()
196196
$this->assertSame('true', $element->getAttribute('w:val'));
197197
}
198198

199+
public function testUpdateFields()
200+
{
201+
$phpWord = new PhpWord();
202+
$phpWord->getSettings()->setUpdateFields(true);
203+
204+
$doc = TestHelperDOCX::getDocument($phpWord);
205+
206+
$file = 'word/settings.xml';
207+
208+
$path = '/w:settings/w:updateFields';
209+
$this->assertTrue($doc->elementExists($path, $file));
210+
211+
$element = $doc->getElement($path, $file);
212+
$this->assertSame('true', $element->getAttribute('w:val'));
213+
}
214+
199215
/**
200216
* Test zoom percentage
201217
*/
@@ -274,6 +290,38 @@ public function testRevisionView()
274290
$this->assertEquals('true', $element->getAttribute('w:comments'));
275291
}
276292

293+
public function testHideSpellingErrors()
294+
{
295+
$phpWord = new PhpWord();
296+
$phpWord->getSettings()->setHideSpellingErrors(true);
297+
298+
$doc = TestHelperDOCX::getDocument($phpWord);
299+
300+
$file = 'word/settings.xml';
301+
302+
$path = '/w:settings/w:hideSpellingErrors';
303+
$this->assertTrue($doc->elementExists($path, $file));
304+
305+
$element = $doc->getElement($path, $file);
306+
$this->assertSame('true', $element->getAttribute('w:val'));
307+
}
308+
309+
public function testHideGrammaticalErrors()
310+
{
311+
$phpWord = new PhpWord();
312+
$phpWord->getSettings()->setHideGrammaticalErrors(true);
313+
314+
$doc = TestHelperDOCX::getDocument($phpWord);
315+
316+
$file = 'word/settings.xml';
317+
318+
$path = '/w:settings/w:hideGrammaticalErrors';
319+
$this->assertTrue($doc->elementExists($path, $file));
320+
321+
$element = $doc->getElement($path, $file);
322+
$this->assertSame('true', $element->getAttribute('w:val'));
323+
}
324+
277325
/**
278326
* Test track Revisions
279327
*/

0 commit comments

Comments
 (0)