Increase minimum mass for php_sim and some test fixes

This commit is contained in:
Ivan Lanin 2014-05-15 10:24:20 +07:00
parent 27fa3ba233
commit abbf60a3be
4 changed files with 18 additions and 36 deletions

View File

@ -18,7 +18,7 @@ tools:
timeout: 900 timeout: 900
php_sim: php_sim:
enabled: true enabled: true
min_mass: 30 min_mass: 40
php_pdepend: true php_pdepend: true
php_analyzer: true php_analyzer: true
sensiolabs_security_checker: true sensiolabs_security_checker: true

View File

@ -123,23 +123,24 @@ class Table extends Border
public function __construct($tableStyle = null, $firstRowStyle = null) public function __construct($tableStyle = null, $firstRowStyle = null)
{ {
$this->alignment = new Alignment(); $this->alignment = new Alignment();
if ($tableStyle !== null && is_array($tableStyle)) {
$this->setStyleByArray($tableStyle);
}
if ($firstRowStyle !== null && is_array($firstRowStyle)) { if ($firstRowStyle !== null && is_array($firstRowStyle)) {
$this->firstRow = clone $this; $this->firstRow = clone $this;
unset($this->firstRow->firstRow); unset($this->firstRow->firstRow);
unset($this->firstRow->cellMarginBottom); unset($this->firstRow->borderInsideHSize);
unset($this->firstRow->borderInsideHColor);
unset($this->firstRow->borderInsideVSize);
unset($this->firstRow->borderInsideVColor);
unset($this->firstRow->cellMarginTop); unset($this->firstRow->cellMarginTop);
unset($this->firstRow->cellMarginLeft); unset($this->firstRow->cellMarginLeft);
unset($this->firstRow->cellMarginRight); unset($this->firstRow->cellMarginRight);
unset($this->firstRow->borderInsideVColor); unset($this->firstRow->cellMarginBottom);
unset($this->firstRow->borderInsideVSize);
unset($this->firstRow->borderInsideHColor);
unset($this->firstRow->borderInsideHSize);
$this->firstRow->setStyleByArray($firstRowStyle); $this->firstRow->setStyleByArray($firstRowStyle);
} }
if ($tableStyle !== null && is_array($tableStyle)) {
$this->setStyleByArray($tableStyle);
}
} }
/** /**

View File

@ -44,7 +44,7 @@ class ListItemRunTest extends \PHPUnit_Framework_TestCase
*/ */
public function testConstructString() public function testConstructString()
{ {
$oListItemRun = new ListItemRun(0, null, null, 'pStyle'); $oListItemRun = new ListItemRun(0, null, 'pStyle');
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\ListItemRun', $oListItemRun); $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\ListItemRun', $oListItemRun);
$this->assertCount(0, $oListItemRun->getElements()); $this->assertCount(0, $oListItemRun->getElements());
@ -56,29 +56,22 @@ class ListItemRunTest extends \PHPUnit_Framework_TestCase
*/ */
public function testConstructArray() public function testConstructArray()
{ {
$oListItemRun = new ListItemRun(0, null, null, array('spacing' => 100)); $oListItemRun = new ListItemRun(0, null, array('spacing' => 100));
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\ListItemRun', $oListItemRun); $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\ListItemRun', $oListItemRun);
$this->assertCount(0, $oListItemRun->getElements()); $this->assertCount(0, $oListItemRun->getElements());
$this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $oListItemRun->getParagraphStyle()); $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $oListItemRun->getParagraphStyle());
} }
/** /**
* Get style * Get style
*/ */
public function testStyle() public function testStyle()
{ {
$oListItemRun = new ListItemRun( $oListItemRun = new ListItemRun(1, array('listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER));
1,
null,
array('listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER)
);
$this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\ListItem', $oListItemRun->getStyle()); $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\ListItem', $oListItemRun->getStyle());
$this->assertEquals( $this->assertEquals($oListItemRun->getStyle()->getListType(), \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER);
$oListItemRun->getStyle()->getListType(),
\PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER
);
} }
/** /**
* getDepth * getDepth
@ -87,10 +80,10 @@ class ListItemRunTest extends \PHPUnit_Framework_TestCase
{ {
$iVal = rand(1, 1000); $iVal = rand(1, 1000);
$oListItemRun = new ListItemRun($iVal); $oListItemRun = new ListItemRun($iVal);
$this->assertEquals($oListItemRun->getDepth(), $iVal); $this->assertEquals($oListItemRun->getDepth(), $iVal);
} }
/** /**
* Add text * Add text
*/ */

View File

@ -47,16 +47,4 @@ class TitleTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($oTitle->getStyle(), null); $this->assertEquals($oTitle->getStyle(), null);
} }
/**
* Get bookmark Id
*/
public function testBookmarkID()
{
$oTitle = new Title('text');
$iVal = rand(1, 1000);
$oTitle->setBookmarkId($iVal);
$this->assertEquals($oTitle->getRelationId(), $iVal);
}
} }