Fix section settings failed tests

This commit is contained in:
Ivan Lanin 2014-03-10 03:51:06 +07:00
parent 663e9008b3
commit 6697057180
2 changed files with 19 additions and 7 deletions

View File

@ -626,6 +626,9 @@ class PHPWord_Section_Settings
* @param int $pValue * @param int $pValue
*/ */
public function setHeaderHeight($pValue = '') { public function setHeaderHeight($pValue = '') {
if (!is_numeric($pValue)) {
$pValue = 720;
}
$this->headerHeight = $pValue; $this->headerHeight = $pValue;
return $this; return $this;
} }
@ -645,6 +648,9 @@ class PHPWord_Section_Settings
* @param int $pValue * @param int $pValue
*/ */
public function setFooterHeight($pValue = '') { public function setFooterHeight($pValue = '') {
if (!is_numeric($pValue)) {
$pValue = 720;
}
$this->footerHeight = $pValue; $this->footerHeight = $pValue;
return $this; return $this;
} }
@ -655,6 +661,9 @@ class PHPWord_Section_Settings
* @param int $pValue * @param int $pValue
*/ */
public function setColsNum($pValue = '') { public function setColsNum($pValue = '') {
if (!is_numeric($pValue)) {
$pValue = 1;
}
$this->_colsNum = $pValue; $this->_colsNum = $pValue;
return $this; return $this;
} }
@ -674,6 +683,9 @@ class PHPWord_Section_Settings
* @param int $pValue * @param int $pValue
*/ */
public function setColsSpace($pValue = '') { public function setColsSpace($pValue = '') {
if (!is_numeric($pValue)) {
$pValue = 720;
}
$this->_colsSpace = $pValue; $this->_colsSpace = $pValue;
return $this; return $this;
} }

View File

@ -217,7 +217,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($iVal, $oSettings->getColsSpace()); $this->assertEquals($iVal, $oSettings->getColsSpace());
$this->assertInstanceOf('PHPWord_Section_Settings', $oSettings->setColsSpace()); $this->assertInstanceOf('PHPWord_Section_Settings', $oSettings->setColsSpace());
$this->assertEquals(1, $oSettings->getColsSpace()); $this->assertEquals(720, $oSettings->getColsSpace());
} }
public function testBreakType() public function testBreakType()