Add missing tests

This commit is contained in:
Frank Liepert 2018-02-15 20:12:56 +01:00 committed by troosan
parent edc3aa3cce
commit 9ffbd98cc6
1 changed files with 48 additions and 0 deletions

View File

@ -196,6 +196,22 @@ class SettingsTest extends \PHPUnit\Framework\TestCase
$this->assertSame('true', $element->getAttribute('w:val'));
}
public function testUpdateFields()
{
$phpWord = new PhpWord();
$phpWord->getSettings()->setUpdateFields(true);
$doc = TestHelperDOCX::getDocument($phpWord);
$file = 'word/settings.xml';
$path = '/w:settings/w:updateFields';
$this->assertTrue($doc->elementExists($path, $file));
$element = $doc->getElement($path, $file);
$this->assertSame('true', $element->getAttribute('w:val'));
}
/**
* Test zoom percentage
*/
@ -274,6 +290,38 @@ class SettingsTest extends \PHPUnit\Framework\TestCase
$this->assertEquals('true', $element->getAttribute('w:comments'));
}
public function testHideSpellingErrors()
{
$phpWord = new PhpWord();
$phpWord->getSettings()->setHideSpellingErrors(true);
$doc = TestHelperDOCX::getDocument($phpWord);
$file = 'word/settings.xml';
$path = '/w:settings/w:hideSpellingErrors';
$this->assertTrue($doc->elementExists($path, $file));
$element = $doc->getElement($path, $file);
$this->assertSame('true', $element->getAttribute('w:val'));
}
public function testHideGrammaticalErrors()
{
$phpWord = new PhpWord();
$phpWord->getSettings()->setHideGrammaticalErrors(true);
$doc = TestHelperDOCX::getDocument($phpWord);
$file = 'word/settings.xml';
$path = '/w:settings/w:hideGrammaticalErrors';
$this->assertTrue($doc->elementExists($path, $file));
$element = $doc->getElement($path, $file);
$this->assertSame('true', $element->getAttribute('w:val'));
}
/**
* Test track Revisions
*/