Row objects and Cell styling
This commit introduces Row and Cell entities, that will replace the arrays passed in previously. It also adds support for Cell styling (instead of Row styling only).
This commit is contained in:
1 parent
fec27e9056
commit
7274226b75
32 files changed
+1113
-859
No files matched your search
@@ -3,6 +3,7 @@
|
||||
namespace Box\Spout\Reader\XLSX\Helper;
|
||||
|
||||
use Box\Spout\Common\Helper\Escaper;
|
||||
use Box\Spout\Reader\XLSX\Manager\StyleManager;
|
||||
|
||||
/**
|
||||
* Class CellValueFormatterTest
|
||||
@@ -61,7 +62,7 @@ class CellValueFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testExcelDate($shouldUse1904Dates, $nodeValue, $expectedDateAsString)
|
||||
{
|
||||
$nodeListMock = $this->getMockBuilder('DOMNodeList')->disableOriginalConstructor()->getMock();
|
||||
$nodeListMock = $this->createMock(\DOMNodeList::class);
|
||||
|
||||
$nodeListMock
|
||||
->expects($this->atLeastOnce())
|
||||
@@ -69,7 +70,7 @@ class CellValueFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
->with(0)
|
||||
->will($this->returnValue((object) ['nodeValue' => $nodeValue]));
|
||||
|
||||
$nodeMock = $this->getMockBuilder('DOMElement')->disableOriginalConstructor()->getMock();
|
||||
$nodeMock = $this->createMock(\DOMElement::class);
|
||||
|
||||
$nodeMock
|
||||
->expects($this->atLeastOnce())
|
||||
@@ -85,8 +86,8 @@ class CellValueFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
->with(CellValueFormatter::XML_NODE_VALUE)
|
||||
->will($this->returnValue($nodeListMock));
|
||||
|
||||
/** @var \Box\Spout\Reader\XLSX\Manager\StyleManager|\PHPUnit_Framework_MockObject_MockObject $styleManagerMock */
|
||||
$styleManagerMock = $this->getMockBuilder('Box\Spout\Reader\XLSX\Manager\StyleManager')->disableOriginalConstructor()->getMock();
|
||||
/** @var StyleManager|\PHPUnit_Framework_MockObject_MockObject $styleManagerMock */
|
||||
$styleManagerMock = $this->createMock(StyleManager::class);
|
||||
|
||||
$styleManagerMock
|
||||
->expects($this->once())
|
||||
@@ -141,8 +142,8 @@ class CellValueFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testFormatNumericCellValueWithNumbers($value, $expectedFormattedValue, $expectedType)
|
||||
{
|
||||
/** @var \Box\Spout\Reader\XLSX\Manager\StyleManager|\PHPUnit_Framework_MockObject_MockObject $styleManagerMock */
|
||||
$styleManagerMock = $this->getMockBuilder('Box\Spout\Reader\XLSX\Manager\StyleManager')->disableOriginalConstructor()->getMock();
|
||||
/** @var StyleManager|\PHPUnit_Framework_MockObject_MockObject $styleManagerMock */
|
||||
$styleManagerMock = $this->createMock(StyleManager::class);
|
||||
$styleManagerMock
|
||||
->expects($this->once())
|
||||
->method('shouldFormatNumericValueAsDate')
|
||||
@@ -177,14 +178,14 @@ class CellValueFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testFormatInlineStringCellValue($value, $expectedFormattedValue)
|
||||
{
|
||||
$nodeListMock = $this->getMockBuilder('DOMNodeList')->disableOriginalConstructor()->getMock();
|
||||
$nodeListMock = $this->createMock(\DOMNodeList::class);
|
||||
$nodeListMock
|
||||
->expects($this->atLeastOnce())
|
||||
->method('item')
|
||||
->with(0)
|
||||
->will($this->returnValue((object) ['nodeValue' => $value]));
|
||||
|
||||
$nodeMock = $this->getMockBuilder('DOMElement')->disableOriginalConstructor()->getMock();
|
||||
$nodeMock = $this->createMock(\DOMElement::class);
|
||||
$nodeMock
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getElementsByTagName')
|
||||
|
||||
Reference in new issue
Block a user