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

@ -617,7 +617,7 @@ class PHPWord_Section_Settings
* @return int * @return int
*/ */
public function getHeaderHeight() { public function getHeaderHeight() {
return $this->headerHeight; return $this->headerHeight;
} }
/** /**
@ -626,8 +626,11 @@ class PHPWord_Section_Settings
* @param int $pValue * @param int $pValue
*/ */
public function setHeaderHeight($pValue = '') { public function setHeaderHeight($pValue = '') {
$this->headerHeight = $pValue; if (!is_numeric($pValue)) {
return $this; $pValue = 720;
}
$this->headerHeight = $pValue;
return $this;
} }
/** /**
@ -636,7 +639,7 @@ class PHPWord_Section_Settings
* @return int * @return int
*/ */
public function getFooterHeight() { public function getFooterHeight() {
return $this->footerHeight; return $this->footerHeight;
} }
/** /**
@ -645,8 +648,11 @@ class PHPWord_Section_Settings
* @param int $pValue * @param int $pValue
*/ */
public function setFooterHeight($pValue = '') { public function setFooterHeight($pValue = '') {
$this->footerHeight = $pValue; if (!is_numeric($pValue)) {
return $this; $pValue = 720;
}
$this->footerHeight = $pValue;
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()