Skip to content

Commit e07195c

Browse files
committed
add test, fix warnings
1 parent 670d46e commit e07195c

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

src/PhpWord/Shared/Html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
namespace PhpOffice\PhpWord\Shared;
1919

2020
use PhpOffice\PhpWord\Element\AbstractContainer;
21+
use PhpOffice\PhpWord\Element\Cell;
2122
use PhpOffice\PhpWord\Element\Row;
2223
use PhpOffice\PhpWord\Element\Table;
2324
use PhpOffice\PhpWord\SimpleType\Jc;
24-
use PhpOffice\PhpWord\Element\Cell;
2525

2626
/**
2727
* Common Html functions

src/PhpWord/Style/Paragraph.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
use PhpOffice\Common\Text;
2121
use PhpOffice\PhpWord\Exception\InvalidStyleException;
2222
use PhpOffice\PhpWord\SimpleType\Jc;
23-
use PhpOffice\PhpWord\SimpleType\TextAlignment;
2423
use PhpOffice\PhpWord\SimpleType\LineSpacingRule;
24+
use PhpOffice\PhpWord\SimpleType\TextAlignment;
2525

2626
/**
2727
* Paragraph style

src/PhpWord/Style/Spacing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function getLineRule()
143143
{
144144
return $this->lineRule;
145145
}
146-
146+
147147
/**
148148
* Set line rule
149149
*

tests/PhpWord/Style/ParagraphTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
namespace PhpOffice\PhpWord\Style;
1919

2020
use PhpOffice\PhpWord\PhpWord;
21-
use PhpOffice\PhpWord\TestHelperDOCX;
2221
use PhpOffice\PhpWord\SimpleType\LineSpacingRule;
22+
use PhpOffice\PhpWord\TestHelperDOCX;
2323

2424
/**
2525
* Test class for PhpOffice\PhpWord\Style\Paragraph

tests/PhpWord/Writer/Word2007/Part/DocumentTest.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
use PhpOffice\PhpWord\PhpWord;
2323
use PhpOffice\PhpWord\SimpleType\Jc;
2424
use PhpOffice\PhpWord\SimpleType\NumberFormat;
25+
use PhpOffice\PhpWord\Style\Cell;
2526
use PhpOffice\PhpWord\Style\Font;
27+
use PhpOffice\PhpWord\Style\Paragraph;
2628
use PhpOffice\PhpWord\TestHelperDOCX;
2729

2830
/**
@@ -532,6 +534,25 @@ public function testWriteFontStyle()
532534
$this->assertTrue($doc->elementExists("{$parent}/w:smallCaps"));
533535
}
534536

537+
/**
538+
* Tests that if no color is set on a cell a border gets writen with the default color
539+
*/
540+
public function testWriteDefaultColor()
541+
{
542+
$phpWord = new PhpWord();
543+
$section = $phpWord->addSection();
544+
545+
$cStyles['borderTopSize'] = 120;
546+
547+
$table = $section->addTable();
548+
$table->addRow();
549+
$cell = $table->addCell(null, $cStyles);
550+
$cell->addText('Test');
551+
552+
$doc = TestHelperDOCX::getDocument($phpWord);
553+
$this->assertEquals(Cell::DEFAULT_BORDER_COLOR, $doc->getElementAttribute('/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:top', 'w:color'));
554+
}
555+
535556
/**
536557
* covers ::_writeTableStyle
537558
*/
@@ -565,7 +586,7 @@ public function testWriteTableStyle()
565586

566587
$section = $phpWord->addSection();
567588
$table = $section->addTable($tStyles);
568-
$table->setWidth = 100;
589+
$table->setWidth(100);
569590
$table->addRow($rHeight, $rStyles);
570591
$cell = $table->addCell($cWidth, $cStyles);
571592
$cell->addText('Test');

0 commit comments

Comments
 (0)