Additional writer test
This commit is contained in:
parent
a65c3c3cf1
commit
991016a48b
|
|
@ -86,7 +86,7 @@ class String
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns unicode array from UTF8 text
|
||||
* Returns unicode from UTF8 text
|
||||
*
|
||||
* The function is splitted to reduce cyclomatic complexity
|
||||
*
|
||||
|
|
@ -100,7 +100,7 @@ class String
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns unicode from UTF8 text
|
||||
* Returns unicode array from UTF8 text
|
||||
*
|
||||
* @param string $text UTF8 text
|
||||
* @return array
|
||||
|
|
|
|||
|
|
@ -115,13 +115,15 @@ class Content extends AbstractPart
|
|||
$xmlWriter->startElement('office:automatic-styles');
|
||||
|
||||
$this->writeTextStyles($xmlWriter);
|
||||
foreach ($this->autoStyles as $element => $style) {
|
||||
foreach ($this->autoStyles as $element => $styles) {
|
||||
$writerClass = 'PhpOffice\\PhpWord\\Writer\\ODText\\Style\\' . $element;
|
||||
foreach ($styles as $style) {
|
||||
|
||||
/** @var \PhpOffice\PhpWord\Writer\ODText\Style\AbstractStyle $styleWriter Type hint */
|
||||
$styleWriter = new $writerClass($xmlWriter, $style);
|
||||
$styleWriter->write();
|
||||
}
|
||||
}
|
||||
|
||||
$xmlWriter->endElement(); // office:automatic-styles
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ class HTMLTest extends \PHPUnit_Framework_TestCase
|
|||
$textrun = $section->addTextRun('Paragraph');
|
||||
$textrun->addLink('http://test.com');
|
||||
$textrun->addImage($localImage);
|
||||
$textrun->addFootnote();
|
||||
$textrun->addEndnote();
|
||||
$textrun->addFootnote()->addText('Footnote');
|
||||
$textrun->addEndnote()->addText('Endnote');
|
||||
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class ContentTest extends \PHPUnit_Framework_TestCase
|
|||
$phpWord->addFontStyle('Font', array('size' => 11));
|
||||
$phpWord->addParagraphStyle('Paragraph', array('align' => 'center'));
|
||||
|
||||
$section = $phpWord->addSection();
|
||||
$section = $phpWord->addSection(array('colsNum' => 2));
|
||||
$section->addText($expected);
|
||||
$section->addText('Test font style', 'Font');
|
||||
$section->addText('Test paragraph style', null, 'Paragraph');
|
||||
|
|
@ -60,14 +60,14 @@ class ContentTest extends \PHPUnit_Framework_TestCase
|
|||
$section->addTextBreak();
|
||||
$section->addPageBreak();
|
||||
$section->addListItem('Test list item');
|
||||
$section->addImage($imageSrc);
|
||||
$section->addImage($imageSrc, array('width' => 50));
|
||||
$section->addObject($objectSrc);
|
||||
$section->addTOC();
|
||||
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText('Test text run');
|
||||
|
||||
$table = $section->addTable();
|
||||
$table = $section->addTable(array('width' => 50));
|
||||
$cell = $table->addRow()->addCell();
|
||||
$cell = $table->addRow()->addCell();
|
||||
$cell->addText('Test');
|
||||
|
|
@ -82,6 +82,8 @@ class ContentTest extends \PHPUnit_Framework_TestCase
|
|||
$footer = $section->addFooter();
|
||||
$footer->addPreserveText('{PAGE}');
|
||||
|
||||
$table = $section->addTable('tblStyle')->addRow()->addCell();
|
||||
|
||||
$doc = TestHelperDOCX::getDocument($phpWord, 'ODText');
|
||||
|
||||
$element = "/office:document-content/office:body/office:text/text:section/text:p";
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class StyleTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testEmptyStyles()
|
||||
{
|
||||
$styles = array('Font', 'Paragraph');
|
||||
$styles = array('Font', 'Paragraph', 'Image', 'Section', 'Table');
|
||||
foreach ($styles as $style) {
|
||||
$objectClass = 'PhpOffice\\PhpWord\\Writer\\ODText\\Style\\' . $style;
|
||||
$xmlWriter = new XMLWriter();
|
||||
|
|
|
|||
Loading…
Reference in New Issue