2014-03-09 19:09:22 +01:00
|
|
|
<?php
|
2014-03-27 23:55:06 +07:00
|
|
|
/**
|
2014-05-05 13:06:53 +04:00
|
|
|
* This file is part of PHPWord - A pure PHP library for reading and writing
|
|
|
|
|
* word processing documents.
|
|
|
|
|
*
|
|
|
|
|
* PHPWord is free software distributed under the terms of the GNU Lesser
|
|
|
|
|
* General Public License version 3 as published by the Free Software Foundation.
|
|
|
|
|
*
|
|
|
|
|
* For the full copyright and license information, please read the LICENSE
|
|
|
|
|
* file that was distributed with this source code. For the full list of
|
|
|
|
|
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
2014-03-27 23:55:06 +07:00
|
|
|
*
|
|
|
|
|
* @link https://github.com/PHPOffice/PHPWord
|
2016-07-31 12:35:06 +04:00
|
|
|
* @copyright 2010-2016 PHPWord contributors
|
2014-05-04 21:03:28 +04:00
|
|
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
2014-03-27 23:55:06 +07:00
|
|
|
*/
|
|
|
|
|
|
2015-11-15 13:33:05 +04:00
|
|
|
namespace PhpOffice\PhpWord\Element;
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-27 23:55:06 +07:00
|
|
|
/**
|
2014-04-02 11:11:59 +07:00
|
|
|
* Test class for PhpOffice\PhpWord\Element\Row
|
2014-03-27 23:55:06 +07:00
|
|
|
*
|
2014-04-02 11:11:59 +07:00
|
|
|
* @coversDefaultClass \PhpOffice\PhpWord\Element\Row
|
2014-03-27 23:55:06 +07:00
|
|
|
* @runTestsInSeparateProcesses
|
|
|
|
|
*/
|
2014-03-09 15:04:23 -04:00
|
|
|
class RowTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
{
|
2014-03-30 14:15:23 +07:00
|
|
|
/**
|
|
|
|
|
* Create new instance
|
|
|
|
|
*/
|
2014-03-09 15:04:23 -04:00
|
|
|
public function testConstruct()
|
|
|
|
|
{
|
2014-05-11 22:54:51 +07:00
|
|
|
$oRow = new Row();
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-04-02 11:11:59 +07:00
|
|
|
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Row', $oRow);
|
2015-02-06 22:28:31 +04:00
|
|
|
$this->assertNull($oRow->getHeight());
|
2014-03-09 15:04:23 -04:00
|
|
|
$this->assertInternalType('array', $oRow->getCells());
|
|
|
|
|
$this->assertCount(0, $oRow->getCells());
|
2014-03-18 17:26:03 +04:00
|
|
|
$this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Row', $oRow->getStyle());
|
2014-03-09 15:04:23 -04:00
|
|
|
}
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-30 14:15:23 +07:00
|
|
|
/**
|
|
|
|
|
* Create new instance with parameters
|
|
|
|
|
*/
|
2014-03-09 15:04:23 -04:00
|
|
|
public function testConstructWithParams()
|
|
|
|
|
{
|
|
|
|
|
$iVal = rand(1, 1000);
|
2014-05-11 22:54:51 +07:00
|
|
|
$oRow = new Row($iVal, array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF'));
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2015-02-06 22:28:31 +04:00
|
|
|
$this->assertEquals($iVal, $oRow->getHeight());
|
2014-03-18 17:26:03 +04:00
|
|
|
$this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Row', $oRow->getStyle());
|
2014-03-09 15:04:23 -04:00
|
|
|
}
|
2014-03-09 19:09:22 +01:00
|
|
|
|
2014-03-30 14:15:23 +07:00
|
|
|
/**
|
|
|
|
|
* Add cell
|
|
|
|
|
*/
|
2014-03-09 15:04:23 -04:00
|
|
|
public function testAddCell()
|
|
|
|
|
{
|
2014-05-11 22:54:51 +07:00
|
|
|
$oRow = new Row();
|
2014-03-09 15:04:23 -04:00
|
|
|
$element = $oRow->addCell();
|
|
|
|
|
|
2014-04-02 11:11:59 +07:00
|
|
|
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Cell', $element);
|
2014-03-09 15:04:23 -04:00
|
|
|
$this->assertCount(1, $oRow->getCells());
|
|
|
|
|
}
|
2014-03-11 21:44:54 +07:00
|
|
|
}
|