update 1.0.8.0
Commits for version update
This commit is contained in:
109
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/AutoFilter/Column/RuleTest.php
vendored
Normal file
109
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/AutoFilter/Column/RuleTest.php
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
|
||||
class RuleTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $_testAutoFilterRuleObject;
|
||||
|
||||
private $_mockAutoFilterColumnObject;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->_mockAutoFilterColumnObject = $this->getMockBuilder('PHPExcel_Worksheet_AutoFilter_Column')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->_mockAutoFilterColumnObject->expects($this->any())
|
||||
->method('testColumnInRange')
|
||||
->will($this->returnValue(3));
|
||||
|
||||
$this->_testAutoFilterRuleObject = new PHPExcel_Worksheet_AutoFilter_Column_Rule(
|
||||
$this->_mockAutoFilterColumnObject
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetRuleType()
|
||||
{
|
||||
$result = $this->_testAutoFilterRuleObject->getRuleType();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER, $result);
|
||||
}
|
||||
|
||||
public function testSetRuleType()
|
||||
{
|
||||
$expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP;
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setRuleType($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
|
||||
$result = $this->_testAutoFilterRuleObject->getRuleType();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testSetValue()
|
||||
{
|
||||
$expectedResult = 100;
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setValue($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
|
||||
$result = $this->_testAutoFilterRuleObject->getValue();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testGetOperator()
|
||||
{
|
||||
$result = $this->_testAutoFilterRuleObject->getOperator();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL, $result);
|
||||
}
|
||||
|
||||
public function testSetOperator()
|
||||
{
|
||||
$expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN;
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setOperator($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
|
||||
$result = $this->_testAutoFilterRuleObject->getOperator();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testSetGrouping()
|
||||
{
|
||||
$expectedResult = PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH;
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setGrouping($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
|
||||
$result = $this->_testAutoFilterRuleObject->getGrouping();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testGetParent()
|
||||
{
|
||||
$result = $this->_testAutoFilterRuleObject->getParent();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
|
||||
public function testSetParent()
|
||||
{
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterRuleObject->setParent($this->_mockAutoFilterColumnObject);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
}
|
||||
|
||||
public function testClone()
|
||||
{
|
||||
$result = clone $this->_testAutoFilterRuleObject;
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column_Rule', $result);
|
||||
}
|
||||
|
||||
}
|
173
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/AutoFilter/ColumnTest.php
vendored
Normal file
173
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/AutoFilter/ColumnTest.php
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
|
||||
class AutofilterColumnTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $_testInitialColumn = 'H';
|
||||
|
||||
private $_testAutoFilterColumnObject;
|
||||
|
||||
private $_mockAutoFilterObject;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->_mockAutoFilterObject = $this->getMockBuilder('PHPExcel_Worksheet_AutoFilter')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->_mockAutoFilterObject->expects($this->any())
|
||||
->method('testColumnInRange')
|
||||
->will($this->returnValue(3));
|
||||
|
||||
$this->_testAutoFilterColumnObject = new PHPExcel_Worksheet_AutoFilter_Column(
|
||||
$this->_testInitialColumn,
|
||||
$this->_mockAutoFilterObject
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetColumnIndex()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->getColumnIndex();
|
||||
$this->assertEquals($this->_testInitialColumn, $result);
|
||||
}
|
||||
|
||||
public function testSetColumnIndex()
|
||||
{
|
||||
$expectedResult = 'L';
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterColumnObject->setColumnIndex($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
|
||||
$result = $this->_testAutoFilterColumnObject->getColumnIndex();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testGetParent()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->getParent();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
}
|
||||
|
||||
public function testSetParent()
|
||||
{
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterColumnObject->setParent($this->_mockAutoFilterObject);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
|
||||
public function testGetFilterType()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->getFilterType();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER, $result);
|
||||
}
|
||||
|
||||
public function testSetFilterType()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
|
||||
$result = $this->_testAutoFilterColumnObject->getFilterType();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSetInvalidFilterTypeThrowsException()
|
||||
{
|
||||
$expectedResult = 'Unfiltered';
|
||||
|
||||
$result = $this->_testAutoFilterColumnObject->setFilterType($expectedResult);
|
||||
}
|
||||
|
||||
public function testGetJoin()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->getJoin();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR, $result);
|
||||
}
|
||||
|
||||
public function testSetJoin()
|
||||
{
|
||||
$result = $this->_testAutoFilterColumnObject->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
|
||||
$result = $this->_testAutoFilterColumnObject->getJoin();
|
||||
$this->assertEquals(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSetInvalidJoinThrowsException()
|
||||
{
|
||||
$expectedResult = 'Neither';
|
||||
|
||||
$result = $this->_testAutoFilterColumnObject->setJoin($expectedResult);
|
||||
}
|
||||
|
||||
public function testSetAttributes()
|
||||
{
|
||||
$attributeSet = array( 'val' => 100,
|
||||
'maxVal' => 200
|
||||
);
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterColumnObject->setAttributes($attributeSet);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
|
||||
public function testGetAttributes()
|
||||
{
|
||||
$attributeSet = array( 'val' => 100,
|
||||
'maxVal' => 200
|
||||
);
|
||||
|
||||
$this->_testAutoFilterColumnObject->setAttributes($attributeSet);
|
||||
|
||||
$result = $this->_testAutoFilterColumnObject->getAttributes();
|
||||
$this->assertTrue(is_array($result));
|
||||
$this->assertEquals(count($attributeSet), count($result));
|
||||
}
|
||||
|
||||
public function testSetAttribute()
|
||||
{
|
||||
$attributeSet = array( 'val' => 100,
|
||||
'maxVal' => 200
|
||||
);
|
||||
|
||||
foreach($attributeSet as $attributeName => $attributeValue) {
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterColumnObject->setAttribute($attributeName,$attributeValue);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetAttribute()
|
||||
{
|
||||
$attributeSet = array( 'val' => 100,
|
||||
'maxVal' => 200
|
||||
);
|
||||
|
||||
$this->_testAutoFilterColumnObject->setAttributes($attributeSet);
|
||||
|
||||
foreach($attributeSet as $attributeName => $attributeValue) {
|
||||
$result = $this->_testAutoFilterColumnObject->getAttribute($attributeName);
|
||||
$this->assertEquals($attributeValue, $result);
|
||||
}
|
||||
$result = $this->_testAutoFilterColumnObject->getAttribute('nonExistentAttribute');
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
public function testClone()
|
||||
{
|
||||
$result = clone $this->_testAutoFilterColumnObject;
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
|
||||
}
|
340
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/AutoFilterTest.php
vendored
Normal file
340
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/AutoFilterTest.php
vendored
Normal file
@@ -0,0 +1,340 @@
|
||||
<?php
|
||||
|
||||
|
||||
class AutoFilterTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $_testInitialRange = 'H2:O256';
|
||||
|
||||
private $_testAutoFilterObject;
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->_mockWorksheetObject = $this->getMockBuilder('PHPExcel_Worksheet')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->_mockCacheController = $this->getMockBuilder('PHPExcel_CachedObjectStorage_Memory')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->_mockWorksheetObject->expects($this->any())
|
||||
->method('getCellCacheController')
|
||||
->will($this->returnValue($this->_mockCacheController));
|
||||
|
||||
$this->_testAutoFilterObject = new PHPExcel_Worksheet_AutoFilter(
|
||||
$this->_testInitialRange,
|
||||
$this->_mockWorksheetObject
|
||||
);
|
||||
}
|
||||
|
||||
public function testToString()
|
||||
{
|
||||
$expectedResult = $this->_testInitialRange;
|
||||
|
||||
// magic __toString should return the active autofilter range
|
||||
$result = $this->_testAutoFilterObject;
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testGetParent()
|
||||
{
|
||||
$result = $this->_testAutoFilterObject->getParent();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet', $result);
|
||||
}
|
||||
|
||||
public function testSetParent()
|
||||
{
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setParent($this->_mockWorksheetObject);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
}
|
||||
|
||||
public function testGetRange()
|
||||
{
|
||||
$expectedResult = $this->_testInitialRange;
|
||||
|
||||
// Result should be the active autofilter range
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
public function testSetRange()
|
||||
{
|
||||
$ranges = array('G1:J512' => 'Worksheet1!G1:J512',
|
||||
'K1:N20' => 'K1:N20'
|
||||
);
|
||||
|
||||
foreach($ranges as $actualRange => $fullRange) {
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setRange($fullRange);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
|
||||
// Result should be the new autofilter range
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($actualRange, $result);
|
||||
}
|
||||
}
|
||||
|
||||
public function testClearRange()
|
||||
{
|
||||
$expectedResult = '';
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setRange();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
|
||||
// Result should be a clear range
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSetRangeInvalidRange()
|
||||
{
|
||||
$expectedResult = 'A1';
|
||||
|
||||
$result = $this->_testAutoFilterObject->setRange($expectedResult);
|
||||
}
|
||||
|
||||
public function testGetColumnsEmpty()
|
||||
{
|
||||
// There should be no columns yet defined
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(0, count($result));
|
||||
}
|
||||
|
||||
public function testGetColumnOffset()
|
||||
{
|
||||
$columnIndexes = array( 'H' => 0,
|
||||
'K' => 3,
|
||||
'M' => 5
|
||||
);
|
||||
|
||||
// If we request a specific column by its column ID, we should get an
|
||||
// integer returned representing the column offset within the range
|
||||
foreach($columnIndexes as $columnIndex => $columnOffset) {
|
||||
$result = $this->_testAutoFilterObject->getColumnOffset($columnIndex);
|
||||
$this->assertEquals($columnOffset, $result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testGetInvalidColumnOffset()
|
||||
{
|
||||
$invalidColumn = 'G';
|
||||
|
||||
$result = $this->_testAutoFilterObject->getColumnOffset($invalidColumn);
|
||||
}
|
||||
|
||||
public function testSetColumnWithString()
|
||||
{
|
||||
$expectedResult = 'L';
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setColumn($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column
|
||||
// objects for each column we set indexed by the column ID
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertArrayHasKey($expectedResult,$result);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$expectedResult]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSetInvalidColumnWithString()
|
||||
{
|
||||
$invalidColumn = 'A';
|
||||
|
||||
$result = $this->_testAutoFilterObject->setColumn($invalidColumn);
|
||||
}
|
||||
|
||||
public function testSetColumnWithColumnObject()
|
||||
{
|
||||
$expectedResult = 'M';
|
||||
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($expectedResult);
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setColumn($columnObject);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column
|
||||
// objects for each column we set indexed by the column ID
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertArrayHasKey($expectedResult,$result);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$expectedResult]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSetInvalidColumnWithObject()
|
||||
{
|
||||
$invalidColumn = 'E';
|
||||
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($invalidColumn);
|
||||
|
||||
$result = $this->_testAutoFilterObject->setColumn($invalidColumn);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSetColumnWithInvalidDataType()
|
||||
{
|
||||
$invalidColumn = 123.456;
|
||||
$columnObject = new PHPExcel_Worksheet_AutoFilter_Column($invalidColumn);
|
||||
|
||||
$result = $this->_testAutoFilterObject->setColumn($invalidColumn);
|
||||
}
|
||||
|
||||
public function testGetColumns()
|
||||
{
|
||||
$columnIndexes = array('L','M');
|
||||
|
||||
foreach($columnIndexes as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
// Result should be an array of PHPExcel_Worksheet_AutoFilter_Column
|
||||
// objects for each column we set indexed by the column ID
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(count($columnIndexes), count($result));
|
||||
foreach($columnIndexes as $columnIndex) {
|
||||
$this->assertArrayHasKey($columnIndex,$result);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result[$columnIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetColumn()
|
||||
{
|
||||
$columnIndexes = array('L','M');
|
||||
|
||||
foreach($columnIndexes as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
|
||||
// If we request a specific column by its column ID, we should
|
||||
// get a PHPExcel_Worksheet_AutoFilter_Column object returned
|
||||
foreach($columnIndexes as $columnIndex) {
|
||||
$result = $this->_testAutoFilterObject->getColumn($columnIndex);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetColumnByOffset()
|
||||
{
|
||||
$columnIndexes = array( 0 => 'H',
|
||||
3 => 'K',
|
||||
5 => 'M'
|
||||
);
|
||||
|
||||
// If we request a specific column by its offset, we should
|
||||
// get a PHPExcel_Worksheet_AutoFilter_Column object returned
|
||||
foreach($columnIndexes as $columnIndex => $columnID) {
|
||||
$result = $this->_testAutoFilterObject->getColumnByOffset($columnIndex);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
$this->assertEquals($result->getColumnIndex(),$columnID);
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetColumnIfNotSet()
|
||||
{
|
||||
// If we request a specific column by its column ID, we should
|
||||
// get a PHPExcel_Worksheet_AutoFilter_Column object returned
|
||||
$result = $this->_testAutoFilterObject->getColumn('K');
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter_Column', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testGetColumnWithoutRangeSet()
|
||||
{
|
||||
// Clear the range
|
||||
$result = $this->_testAutoFilterObject->setRange();
|
||||
|
||||
$result = $this->_testAutoFilterObject->getColumn('A');
|
||||
}
|
||||
|
||||
public function testClearRangeWithExistingColumns()
|
||||
{
|
||||
$expectedResult = '';
|
||||
|
||||
$columnIndexes = array('L','M','N');
|
||||
foreach($columnIndexes as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setRange();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
|
||||
// Range should be cleared
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
|
||||
// Column array should be cleared
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(0, count($result));
|
||||
}
|
||||
|
||||
public function testSetRangeWithExistingColumns()
|
||||
{
|
||||
$expectedResult = 'G1:J512';
|
||||
|
||||
// These columns should be retained
|
||||
$columnIndexes1 = array('I','J');
|
||||
foreach($columnIndexes1 as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
// These columns should be discarded
|
||||
$columnIndexes2 = array('K','L','M');
|
||||
foreach($columnIndexes2 as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
|
||||
// Setters return the instance to implement the fluent interface
|
||||
$result = $this->_testAutoFilterObject->setRange($expectedResult);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
|
||||
// Range should be correctly set
|
||||
$result = $this->_testAutoFilterObject->getRange();
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
|
||||
// Only columns that existed in the original range and that
|
||||
// still fall within the new range should be retained
|
||||
$result = $this->_testAutoFilterObject->getColumns();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(count($columnIndexes1), count($result));
|
||||
}
|
||||
|
||||
public function testClone()
|
||||
{
|
||||
$columnIndexes = array('L','M');
|
||||
|
||||
foreach($columnIndexes as $columnIndex) {
|
||||
$this->_testAutoFilterObject->setColumn($columnIndex);
|
||||
}
|
||||
|
||||
$result = clone $this->_testAutoFilterObject;
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_AutoFilter', $result);
|
||||
}
|
||||
|
||||
}
|
31
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/CellCollectionTest.php
vendored
Normal file
31
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/CellCollectionTest.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
class CellCollectionTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT'))
|
||||
{
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
|
||||
public function testCacheLastCell()
|
||||
{
|
||||
$methods = PHPExcel_CachedObjectStorageFactory::getCacheStorageMethods();
|
||||
foreach ($methods as $method) {
|
||||
PHPExcel_CachedObjectStorageFactory::initialize($method);
|
||||
$workbook = new PHPExcel();
|
||||
$cells = array('A1', 'A2');
|
||||
$worksheet = $workbook->getActiveSheet();
|
||||
$worksheet->setCellValue('A1', 1);
|
||||
$worksheet->setCellValue('A2', 2);
|
||||
$this->assertEquals($cells, $worksheet->getCellCollection(), "Cache method \"$method\".");
|
||||
PHPExcel_CachedObjectStorageFactory::finalize();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
87
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/ColumnCellIteratorTest.php
vendored
Normal file
87
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/ColumnCellIteratorTest.php
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public $mockWorksheet;
|
||||
public $mockColumnCell;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->mockCell = $this->getMockBuilder('PHPExcel_Cell')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->mockWorksheet->expects($this->any())
|
||||
->method('getHighestRow')
|
||||
->will($this->returnValue(5));
|
||||
$this->mockWorksheet->expects($this->any())
|
||||
->method('getCellByColumnAndRow')
|
||||
->will($this->returnValue($this->mockCell));
|
||||
}
|
||||
|
||||
|
||||
public function testIteratorFullRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A');
|
||||
$ColumnCellIndexResult = 1;
|
||||
$this->assertEquals($ColumnCellIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $ColumnCell) {
|
||||
$this->assertEquals($ColumnCellIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Cell', $ColumnCell);
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorStartEndRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
|
||||
$ColumnCellIndexResult = 2;
|
||||
$this->assertEquals($ColumnCellIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $ColumnCell) {
|
||||
$this->assertEquals($ColumnCellIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Cell', $ColumnCell);
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorSeekAndPrev()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
|
||||
$columnIndexResult = 4;
|
||||
$iterator->seek(4);
|
||||
$this->assertEquals($columnIndexResult, $iterator->key());
|
||||
|
||||
for($i = 1; $i < $columnIndexResult-1; $i++) {
|
||||
$iterator->prev();
|
||||
$this->assertEquals($columnIndexResult - $i, $iterator->key());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSeekOutOfRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
|
||||
$iterator->seek(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testPrevOutOfRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
|
||||
$iterator->prev();
|
||||
}
|
||||
|
||||
}
|
89
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/ColumnIteratorTest.php
vendored
Normal file
89
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/ColumnIteratorTest.php
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
class ColumnIteratorTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public $mockWorksheet;
|
||||
public $mockColumn;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->mockColumn = $this->getMockBuilder('PHPExcel_Worksheet_Column')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->mockWorksheet->expects($this->any())
|
||||
->method('getHighestColumn')
|
||||
->will($this->returnValue('E'));
|
||||
$this->mockWorksheet->expects($this->any())
|
||||
->method('current')
|
||||
->will($this->returnValue($this->mockColumn));
|
||||
}
|
||||
|
||||
|
||||
public function testIteratorFullRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet);
|
||||
$columnIndexResult = 'A';
|
||||
$this->assertEquals($columnIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $column) {
|
||||
$this->assertEquals($columnIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Column', $column);
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorStartEndRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D');
|
||||
$columnIndexResult = 'B';
|
||||
$this->assertEquals($columnIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $column) {
|
||||
$this->assertEquals($columnIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Column', $column);
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorSeekAndPrev()
|
||||
{
|
||||
$ranges = range('A','E');
|
||||
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D');
|
||||
$columnIndexResult = 'D';
|
||||
$iterator->seek('D');
|
||||
$this->assertEquals($columnIndexResult, $iterator->key());
|
||||
|
||||
for($i = 1; $i < array_search($columnIndexResult, $ranges); $i++) {
|
||||
$iterator->prev();
|
||||
$expectedResult = $ranges[array_search($columnIndexResult, $ranges) - $i];
|
||||
$this->assertEquals($expectedResult, $iterator->key());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSeekOutOfRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D');
|
||||
$iterator->seek('A');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testPrevOutOfRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D');
|
||||
$iterator->prev();
|
||||
}
|
||||
|
||||
}
|
89
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/RowCellIteratorTest.php
vendored
Normal file
89
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/RowCellIteratorTest.php
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
class RowCellIteratorTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public $mockWorksheet;
|
||||
public $mockRowCell;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->mockCell = $this->getMockBuilder('PHPExcel_Cell')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->mockWorksheet->expects($this->any())
|
||||
->method('getHighestColumn')
|
||||
->will($this->returnValue('E'));
|
||||
$this->mockWorksheet->expects($this->any())
|
||||
->method('getCellByColumnAndRow')
|
||||
->will($this->returnValue($this->mockCell));
|
||||
}
|
||||
|
||||
|
||||
public function testIteratorFullRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet);
|
||||
$RowCellIndexResult = 'A';
|
||||
$this->assertEquals($RowCellIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $RowCell) {
|
||||
$this->assertEquals($RowCellIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Cell', $RowCell);
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorStartEndRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
|
||||
$RowCellIndexResult = 'B';
|
||||
$this->assertEquals($RowCellIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $RowCell) {
|
||||
$this->assertEquals($RowCellIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Cell', $RowCell);
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorSeekAndPrev()
|
||||
{
|
||||
$ranges = range('A','E');
|
||||
$iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
|
||||
$RowCellIndexResult = 'D';
|
||||
$iterator->seek('D');
|
||||
$this->assertEquals($RowCellIndexResult, $iterator->key());
|
||||
|
||||
for($i = 1; $i < array_search($RowCellIndexResult, $ranges); $i++) {
|
||||
$iterator->prev();
|
||||
$expectedResult = $ranges[array_search($RowCellIndexResult, $ranges) - $i];
|
||||
$this->assertEquals($expectedResult, $iterator->key());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSeekOutOfRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
|
||||
$iterator->seek(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testPrevOutOfRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
|
||||
$iterator->prev();
|
||||
}
|
||||
|
||||
}
|
87
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/RowIteratorTest.php
vendored
Normal file
87
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/RowIteratorTest.php
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
class RowIteratorTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public $mockWorksheet;
|
||||
public $mockRow;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->mockRow = $this->getMockBuilder('PHPExcel_Worksheet_Row')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$this->mockWorksheet->expects($this->any())
|
||||
->method('getHighestRow')
|
||||
->will($this->returnValue(5));
|
||||
$this->mockWorksheet->expects($this->any())
|
||||
->method('current')
|
||||
->will($this->returnValue($this->mockRow));
|
||||
}
|
||||
|
||||
|
||||
public function testIteratorFullRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet);
|
||||
$rowIndexResult = 1;
|
||||
$this->assertEquals($rowIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $row) {
|
||||
$this->assertEquals($rowIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Row', $row);
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorStartEndRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4);
|
||||
$rowIndexResult = 2;
|
||||
$this->assertEquals($rowIndexResult, $iterator->key());
|
||||
|
||||
foreach($iterator as $key => $row) {
|
||||
$this->assertEquals($rowIndexResult++, $key);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Row', $row);
|
||||
}
|
||||
}
|
||||
|
||||
public function testIteratorSeekAndPrev()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4);
|
||||
$columnIndexResult = 4;
|
||||
$iterator->seek(4);
|
||||
$this->assertEquals($columnIndexResult, $iterator->key());
|
||||
|
||||
for($i = 1; $i < $columnIndexResult-1; $i++) {
|
||||
$iterator->prev();
|
||||
$this->assertEquals($columnIndexResult - $i, $iterator->key());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testSeekOutOfRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4);
|
||||
$iterator->seek(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPExcel_Exception
|
||||
*/
|
||||
public function testPrevOutOfRange()
|
||||
{
|
||||
$iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4);
|
||||
$iterator->prev();
|
||||
}
|
||||
|
||||
}
|
46
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/WorksheetColumnTest.php
vendored
Normal file
46
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/WorksheetColumnTest.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
class WorksheetColumnTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public $mockWorksheet;
|
||||
public $mockColumn;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->mockWorksheet->expects($this->any())
|
||||
->method('getHighestRow')
|
||||
->will($this->returnValue(5));
|
||||
}
|
||||
|
||||
|
||||
public function testInstantiateColumnDefault()
|
||||
{
|
||||
$column = new PHPExcel_Worksheet_Column($this->mockWorksheet);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Column', $column);
|
||||
$columnIndex = $column->getColumnIndex();
|
||||
$this->assertEquals('A', $columnIndex);
|
||||
}
|
||||
|
||||
public function testInstantiateColumnSpecified()
|
||||
{
|
||||
$column = new PHPExcel_Worksheet_Column($this->mockWorksheet, 'E');
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Column', $column);
|
||||
$columnIndex = $column->getColumnIndex();
|
||||
$this->assertEquals('E', $columnIndex);
|
||||
}
|
||||
|
||||
public function testGetCellIterator()
|
||||
{
|
||||
$column = new PHPExcel_Worksheet_Column($this->mockWorksheet);
|
||||
$cellIterator = $column->getCellIterator();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_ColumnCellIterator', $cellIterator);
|
||||
}
|
||||
}
|
46
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/WorksheetRowTest.php
vendored
Normal file
46
vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Worksheet/WorksheetRowTest.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
class WorksheetRowTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public $mockWorksheet;
|
||||
public $mockRow;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
|
||||
}
|
||||
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
|
||||
$this->mockWorksheet = $this->getMockBuilder('PHPExcel_Worksheet')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->mockWorksheet->expects($this->any())
|
||||
->method('getHighestColumn')
|
||||
->will($this->returnValue('E'));
|
||||
}
|
||||
|
||||
|
||||
public function testInstantiateRowDefault()
|
||||
{
|
||||
$row = new PHPExcel_Worksheet_Row($this->mockWorksheet);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Row', $row);
|
||||
$rowIndex = $row->getRowIndex();
|
||||
$this->assertEquals(1, $rowIndex);
|
||||
}
|
||||
|
||||
public function testInstantiateRowSpecified()
|
||||
{
|
||||
$row = new PHPExcel_Worksheet_Row($this->mockWorksheet, 5);
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_Row', $row);
|
||||
$rowIndex = $row->getRowIndex();
|
||||
$this->assertEquals(5, $rowIndex);
|
||||
}
|
||||
|
||||
public function testGetCellIterator()
|
||||
{
|
||||
$row = new PHPExcel_Worksheet_Row($this->mockWorksheet);
|
||||
$cellIterator = $row->getCellIterator();
|
||||
$this->assertInstanceOf('PHPExcel_Worksheet_RowCellIterator', $cellIterator);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user