Skip to content

Commit 72a6b1b

Browse files
committed
Add unit test
1 parent 5d928db commit 72a6b1b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/PhpWord/Writer/ODText/ElementTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
namespace PhpOffice\PhpWord\Writer\ODText;
1919

2020
use PhpOffice\Common\XMLWriter;
21+
use PhpOffice\PhpWord\PhpWord;
22+
use PhpOffice\PhpWord\TestHelperDOCX;
2123

2224
/**
2325
* Test class for PhpOffice\PhpWord\Writer\ODText\Element subnamespace
@@ -40,4 +42,21 @@ public function testUnmatchedElements()
4042
$this->assertEquals('', $xmlWriter->getData());
4143
}
4244
}
45+
46+
/**
47+
* Test PageBreak
48+
*/
49+
public function testPageBreak()
50+
{
51+
$phpWord = new PhpWord();
52+
$section = $phpWord->addSection();
53+
$section->addText('test');
54+
$section->addPageBreak();
55+
56+
$doc = TestHelperDOCX::getDocument($phpWord, 'ODText');
57+
58+
$element = '/office:document-content/office:body/office:text/text:section/text:p[2]';
59+
$this->assertTrue($doc->elementExists($element, 'content.xml'));
60+
$this->assertEquals('P1', $doc->getElementAttribute($element, 'text:style-name', 'content.xml'));
61+
}
4362
}

0 commit comments

Comments
 (0)