Skip to content

Commit dc6c487

Browse files
committed
Fix test error
1 parent 1e9a498 commit dc6c487

File tree

7 files changed

+13
-9
lines changed

7 files changed

+13
-9
lines changed

src/PhpWord/Element/Image.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,13 @@ public function getImageStringData($base64 = false)
312312
} else {
313313
$actualSource = $source;
314314
}
315-
if ($actualSource === null) {
316-
return null;
317-
}
315+
316+
// Can't find any case where $actualSource = null hasn't captured by
317+
// preceding exceptions. Please uncomment when you find the case and
318+
// put the case into Element\ImageTest.
319+
// if ($actualSource === null) {
320+
// return null;
321+
// }
318322

319323
// Read image binary data and convert to hex/base64 string
320324
if ($this->sourceType == self::SOURCE_GD) {

src/PhpWord/Settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public static function loadConfig($filename = null)
344344
// Parse config file
345345
$config = array();
346346
if ($configFile !== null) {
347-
$config = parse_ini_file($configFile);
347+
$config = @parse_ini_file($configFile);
348348
if ($config === false) {
349349
return $config;
350350
}

src/PhpWord/Shared/Html.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ protected static function parseNode(
214214
*/
215215
case 'li':
216216
$cNodes = $node->childNodes;
217-
if ($cNodes->length > 0) {
217+
if (count($cNodes) > 0) {
218218
$text = '';
219219
foreach ($cNodes as $cNode) {
220220
if ($cNode->nodeName == '#text') {
@@ -240,7 +240,7 @@ protected static function parseNode(
240240
*/
241241
if ($node->nodeName != 'li') {
242242
$cNodes = $node->childNodes;
243-
if ($cNodes->length > 0) {
243+
if (count($cNodes) > 0) {
244244
foreach ($cNodes as $cNode) {
245245
self::parseNode($cNode, $newobject, $styles, $data);
246246
}

src/PhpWord/Writer/Word2007/Part/Numbering.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ private function writeParagraph(XMLWriter $xmlWriter, NumberingLevel $level)
145145
$xmlWriter->startElement('w:tab');
146146
$xmlWriter->writeAttribute('w:val', 'num');
147147
$xmlWriter->writeAttributeIf($tabPos !== null, 'w:pos', $tabPos);
148-
$xmlWriter->writeAttribute('w:pos', $tabPos);
149148
$xmlWriter->endElement(); // w:tab
150149
$xmlWriter->endElement(); // w:tabs
151150

tests/PhpWord/Tests/Element/ImageTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public function testConstruct()
3838
$this->assertEquals($oImage->getSource(), $src);
3939
$this->assertEquals($oImage->getMediaId(), md5($src));
4040
$this->assertEquals($oImage->isWatermark(), false);
41+
$this->assertEquals($oImage->getSourceType(), Image::SOURCE_LOCAL);
4142
$this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Image', $oImage->getStyle());
4243
}
4344

tests/PhpWord/Tests/Element/SectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function testSetSettings()
7373
{
7474
$expected = 'landscape';
7575
$object = new Section(0);
76-
$object->setSettings(array('orientation' => $expected));
76+
$object->setSettings(array('orientation' => $expected, 'foo' => null));
7777
$this->assertEquals($expected, $object->getSettings()->getOrientation());
7878
}
7979

tests/PhpWord/Tests/SettingsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,6 @@ public function testLoadConfig()
111111
$this->assertEquals($expected, Settings::loadConfig(__DIR__ . '/../../../phpword.ini.dist'));
112112

113113
// Test with invalid file
114-
$this->assertEmpty(Settings::loadConfig(__DIR__ . '/files/xsl/passthrough.xsl'));
114+
$this->assertEmpty(Settings::loadConfig(__DIR__ . '/../../../phpunit.xml.dist'));
115115
}
116116
}

0 commit comments

Comments
 (0)