Add unit test

This commit is contained in:
troosan 2017-11-25 23:44:22 +01:00
parent 5d928db916
commit 72a6b1b19f
1 changed files with 19 additions and 0 deletions

View File

@ -18,6 +18,8 @@
namespace PhpOffice\PhpWord\Writer\ODText;
use PhpOffice\Common\XMLWriter;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\TestHelperDOCX;
/**
* Test class for PhpOffice\PhpWord\Writer\ODText\Element subnamespace
@ -40,4 +42,21 @@ class ElementTest extends \PHPUnit\Framework\TestCase
$this->assertEquals('', $xmlWriter->getData());
}
}
/**
* Test PageBreak
*/
public function testPageBreak()
{
$phpWord = new PhpWord();
$section = $phpWord->addSection();
$section->addText('test');
$section->addPageBreak();
$doc = TestHelperDOCX::getDocument($phpWord, 'ODText');
$element = '/office:document-content/office:body/office:text/text:section/text:p[2]';
$this->assertTrue($doc->elementExists($element, 'content.xml'));
$this->assertEquals('P1', $doc->getElementAttribute($element, 'text:style-name', 'content.xml'));
}
}