Add unit test
This commit is contained in:
parent
5d928db916
commit
72a6b1b19f
|
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue