From 2797052c544c4c93a9dbce3085193af05b58f92c Mon Sep 17 00:00:00 2001 From: madflow Date: Fri, 29 Sep 2017 14:47:33 +0200 Subject: [PATCH] make tests pass again --- .../Writer/Common/Creator/EntityFactory.php | 9 ++++--- .../Manager/WorkbookManagerAbstract.php | 3 --- .../Writer/ODS/Manager/WorksheetManager.php | 17 +++---------- src/Spout/Writer/WriterAbstract.php | 5 ++-- .../Writer/WriterMultiSheetsAbstract.php | 1 + tests/Spout/Writer/CSV/WriterTest.php | 19 +++----------- tests/Spout/Writer/ODS/SheetTest.php | 20 +++------------ tests/Spout/Writer/ODS/WriterTest.php | 12 ++++----- .../Spout/Writer/ODS/WriterWithStyleTest.php | 25 ++++++------------- tests/Spout/Writer/XLSX/SheetTest.php | 19 +++----------- tests/Spout/Writer/XLSX/WriterTest.php | 3 +-- .../Spout/Writer/XLSX/WriterWithStyleTest.php | 24 ++++++------------ 12 files changed, 44 insertions(+), 113 deletions(-) diff --git a/src/Spout/Writer/Common/Creator/EntityFactory.php b/src/Spout/Writer/Common/Creator/EntityFactory.php index fd8c1ca..97c3d15 100644 --- a/src/Spout/Writer/Common/Creator/EntityFactory.php +++ b/src/Spout/Writer/Common/Creator/EntityFactory.php @@ -8,7 +8,9 @@ use Box\Spout\Writer\Common\Entity\Sheet; use Box\Spout\Writer\Common\Entity\Style\Style; use Box\Spout\Writer\Common\Entity\Workbook; use Box\Spout\Writer\Common\Entity\Worksheet; +use Box\Spout\Writer\Common\Manager\RowManager; use Box\Spout\Writer\Common\Manager\SheetManager; +use Box\Spout\Writer\Common\Manager\Style\StyleMerger; /** * Class EntityFactory @@ -49,7 +51,7 @@ class EntityFactory * @param mixed $cellValue * @return Cell */ - public function createCell($cellValue) + public static function createCell($cellValue) { return new Cell($cellValue); } @@ -67,9 +69,10 @@ class EntityFactory * @param Style|null $style * @return Row */ - public function createRow(array $cells, Style $style = null) + public static function createRow(array $cells, Style $style = null) { - $rowManager = $this->managerFactory->createRowManager(); + $styleMerger = new StyleMerger(); + $rowManager = new RowManager($styleMerger); return new Row($cells, $style, $rowManager); } } diff --git a/src/Spout/Writer/Common/Manager/WorkbookManagerAbstract.php b/src/Spout/Writer/Common/Manager/WorkbookManagerAbstract.php index 62d4572..71558a6 100644 --- a/src/Spout/Writer/Common/Manager/WorkbookManagerAbstract.php +++ b/src/Spout/Writer/Common/Manager/WorkbookManagerAbstract.php @@ -7,17 +7,14 @@ use Box\Spout\Common\Manager\OptionsManagerInterface; use Box\Spout\Writer\Common\Creator\EntityFactory; use Box\Spout\Writer\Common\Creator\ManagerFactoryInterface; use Box\Spout\Writer\Common\Entity\Options; -use Box\Spout\Writer\Common\Manager\Style\StyleManagerInterface; use Box\Spout\Writer\Common\Entity\Row; use Box\Spout\Writer\Common\Entity\Sheet; -use Box\Spout\Writer\Common\Entity\Style\Style; use Box\Spout\Writer\Common\Entity\Workbook; use Box\Spout\Writer\Common\Entity\Worksheet; use Box\Spout\Writer\Common\Helper\FileSystemWithRootFolderHelperInterface; use Box\Spout\Writer\Common\Manager\Style\StyleManagerInterface; use Box\Spout\Writer\Exception\SheetNotFoundException; use Box\Spout\Writer\Exception\WriterException; -use Box\Spout\Writer\Common\Creator\EntityFactory; /** * Class WorkbookManagerAbstract diff --git a/src/Spout/Writer/ODS/Manager/WorksheetManager.php b/src/Spout/Writer/ODS/Manager/WorksheetManager.php index a9f096b..de85d64 100644 --- a/src/Spout/Writer/ODS/Manager/WorksheetManager.php +++ b/src/Spout/Writer/ODS/Manager/WorksheetManager.php @@ -4,10 +4,10 @@ namespace Box\Spout\Writer\ODS\Manager; use Box\Spout\Common\Exception\InvalidArgumentException; use Box\Spout\Common\Exception\IOException; +use Box\Spout\Common\Helper\Escaper\ODS as ODSEscaper; use Box\Spout\Common\Helper\StringHelper; use Box\Spout\Writer\Common\Creator\EntityFactory; use Box\Spout\Writer\Common\Entity\Cell; -use Box\Spout\Writer\Common\Entity\Style\Style; use Box\Spout\Writer\Common\Entity\Row; use Box\Spout\Writer\Common\Entity\Worksheet; use Box\Spout\Writer\Common\Manager\WorksheetManagerInterface; @@ -25,34 +25,23 @@ class WorksheetManager implements WorksheetManagerInterface /** @var StringHelper String helper */ private $stringHelper; - /** @var EntityFactory Factory to create entities */ - private $entityFactory; - /** @var StyleManager Manages styles */ private $styleManager; /** * WorksheetManager constructor. - * - * @param \Box\Spout\Common\Helper\Escaper\ODS $stringsEscaper * @param StyleManager $styleManager - * @param \Box\Spout\Common\Escaper\ODS $stringsEscaper + * @param ODSEscaper $stringsEscaper * @param StringHelper $stringHelper - * @param EntityFactory $entityFactory */ public function __construct( StyleManager $styleManager, - \Box\Spout\Common\Escaper\ODS $stringsEscaper, + ODSEscaper $stringsEscaper, StringHelper $stringHelper) { - \Box\Spout\Common\Helper\Escaper\ODS $stringsEscaper, - StringHelper $stringHelper, - EntityFactory $entityFactory - ) { $this->stringsEscaper = $stringsEscaper; $this->stringHelper = $stringHelper; $this->styleManager = $styleManager; - $this->entityFactory = $entityFactory; } /** diff --git a/src/Spout/Writer/WriterAbstract.php b/src/Spout/Writer/WriterAbstract.php index 52c18f7..c34aeee 100644 --- a/src/Spout/Writer/WriterAbstract.php +++ b/src/Spout/Writer/WriterAbstract.php @@ -7,6 +7,7 @@ use Box\Spout\Common\Exception\InvalidArgumentException; use Box\Spout\Common\Exception\IOException; use Box\Spout\Common\Exception\SpoutException; use Box\Spout\Common\Helper\GlobalFunctionsHelper; +use Box\Spout\Writer\Common\Creator\EntityFactory; use Box\Spout\Writer\Common\Entity\Cell; use Box\Spout\Common\Manager\OptionsManagerInterface; use Box\Spout\Writer\Common\Entity\Options; @@ -63,8 +64,6 @@ abstract class WriterAbstract implements WriterInterface $this->styleMerger = $styleMerger; $this->globalFunctionsHelper = $globalFunctionsHelper; $this->helperFactory = $helperFactory; - - $this->resetRowStyleToDefault(); } /** @@ -210,7 +209,7 @@ abstract class WriterAbstract implements WriterInterface */ public function withRow(\Closure $callback) { - return $this->addRow($callback(new Row())); + return $this->addRow($callback(EntityFactory::createRow([]))); } /** diff --git a/src/Spout/Writer/WriterMultiSheetsAbstract.php b/src/Spout/Writer/WriterMultiSheetsAbstract.php index 8fd1c2e..d903ad0 100644 --- a/src/Spout/Writer/WriterMultiSheetsAbstract.php +++ b/src/Spout/Writer/WriterMultiSheetsAbstract.php @@ -2,6 +2,7 @@ namespace Box\Spout\Writer; +use Box\Spout\Common\Creator\HelperFactory; use Box\Spout\Common\Helper\GlobalFunctionsHelper; use Box\Spout\Common\Manager\OptionsManagerInterface; use Box\Spout\Writer\Common\Creator\ManagerFactoryInterface; diff --git a/tests/Spout/Writer/CSV/WriterTest.php b/tests/Spout/Writer/CSV/WriterTest.php index d5041e9..ab8b30b 100644 --- a/tests/Spout/Writer/CSV/WriterTest.php +++ b/tests/Spout/Writer/CSV/WriterTest.php @@ -17,17 +17,6 @@ class WriterTest extends \PHPUnit_Framework_TestCase { use TestUsingResource; - /** - * @var EntityFactory - */ - protected $entityFactory; - - protected function setUp() - { - $this->entityFactory = new EntityFactory(new ManagerFactory()); - parent::setUp(); - } - /** * @expectedException \Box\Spout\Common\Exception\IOException */ @@ -39,7 +28,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase $writer = WriterFactory::create(Type::CSV); @$writer->openToFile($filePath); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('csv--11'), new Cell('csv--12') ]); @@ -53,7 +42,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase public function testWriteShouldThrowExceptionIfCallAddRowBeforeOpeningWriter() { $writer = WriterFactory::create(Type::CSV); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('csv--11'), new Cell('csv--12') ]); @@ -67,7 +56,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase public function testWriteShouldThrowExceptionIfCallAddRowsBeforeOpeningWriter() { $writer = WriterFactory::create(Type::CSV); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('csv--11'), new Cell('csv--12') ]); @@ -237,7 +226,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase $writer->openToFile($resourcePath); $writer->addRows(array_map(function ($oneRow) { - $row = $this->entityFactory->createRow(array_map(function ($value) { + $row = EntityFactory::createRow(array_map(function ($value) { return new Cell($value); }, $oneRow)); return $row; diff --git a/tests/Spout/Writer/ODS/SheetTest.php b/tests/Spout/Writer/ODS/SheetTest.php index d8163dd..990e879 100644 --- a/tests/Spout/Writer/ODS/SheetTest.php +++ b/tests/Spout/Writer/ODS/SheetTest.php @@ -17,20 +17,6 @@ class SheetTest extends \PHPUnit_Framework_TestCase { use TestUsingResource; - /** - * @var EntityFactory - */ - protected $entityFactory; - - /** - * @return void - */ - public function setUp() - { - $this->entityFactory = new EntityFactory(new ManagerFactory()); - } - - /** * @return void */ @@ -108,7 +94,7 @@ class SheetTest extends \PHPUnit_Framework_TestCase $sheet = $writer->getCurrentSheet(); $sheet->setName($sheetName); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('ods--11'), new Cell('ods--12'), ]); @@ -129,7 +115,7 @@ class SheetTest extends \PHPUnit_Framework_TestCase $writer = WriterFactory::create(Type::ODS); $writer->openToFile($resourcePath); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('ods--sheet1--11'), new Cell('ods--sheet1--12'), ]); @@ -137,7 +123,7 @@ class SheetTest extends \PHPUnit_Framework_TestCase $writer->addNewSheetAndMakeItCurrent(); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('ods--sheet2--11'), new Cell('ods--sheet2--12'), new Cell('ods--sheet2--13'), diff --git a/tests/Spout/Writer/ODS/WriterTest.php b/tests/Spout/Writer/ODS/WriterTest.php index 86e204e..08ab7d0 100644 --- a/tests/Spout/Writer/ODS/WriterTest.php +++ b/tests/Spout/Writer/ODS/WriterTest.php @@ -7,8 +7,6 @@ use Box\Spout\Common\Type; use Box\Spout\Reader\Wrapper\XMLReader; use Box\Spout\TestUsingResource; use Box\Spout\Writer\Common\Creator\EntityFactory; -use Box\Spout\Writer\Common\Creator\ManagerFactory; -use Box\Spout\Writer\Common\Helper\ZipHelper; use Box\Spout\Writer\Common\Entity\Cell; use Box\Spout\Writer\Common\Helper\ZipHelper; use Box\Spout\Writer\WriterFactory; @@ -30,7 +28,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->entityFactory = new EntityFactory(new ManagerFactory()); + $this->entityFactory = new EntityFactory(); parent::setUp(); } @@ -326,7 +324,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase if ($expectedNumTableCells === 1) { $tableCellNode = $tableCellNodes->item(0); - $numColumnsRepeated = (int) ($tableCellNode->getAttribute('table:number-columns-repeated')); + $numColumnsRepeated = (int)($tableCellNode->getAttribute('table:number-columns-repeated')); $this->assertEquals($expectedNumColumnsRepeated, $numColumnsRepeated); } else { foreach ($tableCellNodes as $tableCellNode) { @@ -340,7 +338,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase */ public function testAddRowShouldWriteGivenDataToTheCorrectSheet() { - $arrayToRows = function(array $allRows) { + $arrayToRows = function (array $allRows) { return array_map(function ($oneRow) { $row = $this->entityFactory->createRow(array_map(function ($value) { return new Cell($value); @@ -536,7 +534,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase foreach ($dataRows as $dataRow) { /** @var Cell $cell */ foreach ($dataRow as $cell) { - $this->assertValueWasWritten($fileName, (string) $cell->getValue(), ''); + $this->assertValueWasWritten($fileName, (string)$cell->getValue(), ''); } } } @@ -559,7 +557,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase $writer->openToFile($resourcePath); $writer->addRows(array_map(function ($oneRow) { $row = $this->entityFactory->createRow(array_map(function ($value) { - if(!$value instanceof Cell) { + if (!$value instanceof Cell) { return new Cell($value); } else { return $value; diff --git a/tests/Spout/Writer/ODS/WriterWithStyleTest.php b/tests/Spout/Writer/ODS/WriterWithStyleTest.php index 84b55be..4a726ea 100644 --- a/tests/Spout/Writer/ODS/WriterWithStyleTest.php +++ b/tests/Spout/Writer/ODS/WriterWithStyleTest.php @@ -6,13 +6,10 @@ use Box\Spout\Common\Type; use Box\Spout\Reader\Wrapper\XMLReader; use Box\Spout\TestUsingResource; use Box\Spout\Writer\Common\Creator\EntityFactory; -use Box\Spout\Writer\Common\Creator\ManagerFactory; use Box\Spout\Writer\Common\Entity\Cell; -use Box\Spout\Writer\ODS\Helper\BorderHelper; use Box\Spout\Writer\Common\Entity\Style\Border; use Box\Spout\Writer\Common\Creator\Style\BorderBuilder; use Box\Spout\Writer\Common\Creator\Style\StyleBuilder; -use Box\Spout\Writer\Common\Entity\Style\Border; use Box\Spout\Writer\Common\Entity\Style\Color; use Box\Spout\Writer\Common\Entity\Style\Style; use Box\Spout\Writer\WriterFactory; @@ -27,17 +24,11 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase /** @var Style */ private $defaultStyle; - /** - * @var EntityFactory - */ - protected $entityFactory; - /** * @return void */ public function setUp() { - $this->entityFactory = new EntityFactory(new ManagerFactory()); $this->defaultStyle = (new StyleBuilder())->build(); } @@ -47,7 +38,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase public function testAddRowWithStyleShouldThrowExceptionIfCallAddRowBeforeOpeningWriter() { $writer = WriterFactory::create(Type::ODS); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('ods--11'), new Cell('ods--12'), ], $this->defaultStyle); @@ -60,7 +51,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase public function testAddRowsWithStyleShouldThrowExceptionIfCalledBeforeOpeningWriter() { $writer = WriterFactory::create(Type::ODS); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('ods--11'), new Cell('ods--12'), ], $this->defaultStyle); @@ -97,7 +88,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase $writer = WriterFactory::create(Type::ODS); $writer->openToFile($resourcePath); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('ods--11'), new Cell('ods--12'), ], $style); @@ -124,7 +115,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase $writer = WriterFactory::create(Type::ODS); $writer->openToFile($resourcePath); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('ods--11'), new Cell('ods--12'), ], $style); @@ -365,7 +356,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase public function testSetDefaultRowStyle() { $fileName = 'test_set_default_row_style.ods'; - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('ods--11') ]); $dataRows = [$row]; @@ -387,9 +378,9 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase */ private function writeToODSFile($allRows, $fileName, $style) { - $arrayToRows = function(array $allRows) use ($style) { + $arrayToRows = function (array $allRows) use ($style) { return array_map(function ($oneRow) use ($style) { - $row = $this->entityFactory->createRow(array_map(function ($value) { + $row = EntityFactory::createRow(array_map(function ($value) { return new Cell($value); }, $oneRow), $style); return $row; @@ -452,7 +443,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase for ($i = 0; $i < count($allRows); $i++) { $currentRow = $allRows[$i]; $currentStyle = $styles[$i]; - $row = $this->entityFactory->createRow(array_map(function ($value) { + $row = EntityFactory::createRow(array_map(function ($value) { return new Cell($value); }, $currentRow), $currentStyle); $writer->addRow($row); diff --git a/tests/Spout/Writer/XLSX/SheetTest.php b/tests/Spout/Writer/XLSX/SheetTest.php index 20e56a7..301496b 100644 --- a/tests/Spout/Writer/XLSX/SheetTest.php +++ b/tests/Spout/Writer/XLSX/SheetTest.php @@ -17,19 +17,6 @@ class SheetTest extends \PHPUnit_Framework_TestCase { use TestUsingResource; - /** - * @var EntityFactory - */ - protected $entityFactory; - - /** - * @return void - */ - public function setUp() - { - $this->entityFactory = new EntityFactory(new ManagerFactory()); - } - /** * @return void */ @@ -107,7 +94,7 @@ class SheetTest extends \PHPUnit_Framework_TestCase $sheet = $writer->getCurrentSheet(); $sheet->setName($sheetName); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('xlsx--11'), new Cell('xlsx--12'), ]); @@ -130,7 +117,7 @@ class SheetTest extends \PHPUnit_Framework_TestCase $writer = WriterFactory::create(Type::XLSX); $writer->openToFile($resourcePath); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('xlsx--sheet1--11'), new Cell('xlsx--sheet1--12'), ]); @@ -138,7 +125,7 @@ class SheetTest extends \PHPUnit_Framework_TestCase $writer->addNewSheetAndMakeItCurrent(); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('xlsx--sheet2--11'), new Cell('xlsx--sheet2--12'), new Cell('xlsx--sheet2--13'), diff --git a/tests/Spout/Writer/XLSX/WriterTest.php b/tests/Spout/Writer/XLSX/WriterTest.php index be5539e..5ba4711 100644 --- a/tests/Spout/Writer/XLSX/WriterTest.php +++ b/tests/Spout/Writer/XLSX/WriterTest.php @@ -6,7 +6,6 @@ use Box\Spout\Common\Exception\SpoutException; use Box\Spout\Common\Type; use Box\Spout\TestUsingResource; use Box\Spout\Writer\Common\Creator\EntityFactory; -use Box\Spout\Writer\Common\Creator\ManagerFactory; use Box\Spout\Writer\Common\Entity\Cell; use Box\Spout\Writer\WriterFactory; use Box\Spout\Writer\XLSX\Manager\WorksheetManager; @@ -28,7 +27,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->entityFactory = new EntityFactory(new ManagerFactory()); + $this->entityFactory = new EntityFactory(); parent::setUp(); } diff --git a/tests/Spout/Writer/XLSX/WriterWithStyleTest.php b/tests/Spout/Writer/XLSX/WriterWithStyleTest.php index 159a8bb..bb05d7f 100644 --- a/tests/Spout/Writer/XLSX/WriterWithStyleTest.php +++ b/tests/Spout/Writer/XLSX/WriterWithStyleTest.php @@ -6,11 +6,9 @@ use Box\Spout\Common\Type; use Box\Spout\Reader\Wrapper\XMLReader; use Box\Spout\TestUsingResource; use Box\Spout\Writer\Common\Creator\EntityFactory; -use Box\Spout\Writer\Common\Creator\ManagerFactory; -use Box\Spout\Writer\Common\Entity\Cell; -use Box\Spout\Writer\Common\Entity\Style\Border; use Box\Spout\Writer\Common\Creator\Style\BorderBuilder; use Box\Spout\Writer\Common\Creator\Style\StyleBuilder; +use Box\Spout\Writer\Common\Entity\Cell; use Box\Spout\Writer\Common\Entity\Style\Border; use Box\Spout\Writer\Common\Entity\Style\Color; use Box\Spout\Writer\Common\Entity\Style\Style; @@ -28,18 +26,12 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase /** @var \Box\Spout\Writer\Common\Entity\Style\Style */ private $defaultStyle; - /** - * @var EntityFactory - */ - protected $entityFactory; - /** * @return void */ public function setUp() { $this->defaultStyle = (new StyleBuilder())->build(); - $this->entityFactory = new EntityFactory(new ManagerFactory()); } /** @@ -48,7 +40,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase public function testAddRowWithStyleShouldThrowExceptionIfCallAddRowBeforeOpeningWriter() { $writer = WriterFactory::create(Type::XLSX); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('xlsx--11'), new Cell('xlsx--12') ], $this->defaultStyle); @@ -61,7 +53,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase public function testAddRowsWithStyleShouldThrowExceptionIfCalledBeforeOpeningWriter() { $writer = WriterFactory::create(Type::XLSX); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('xlsx--11'), new Cell('xlsx--12') ], $this->defaultStyle); @@ -98,7 +90,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase $writer = WriterFactory::create(Type::XLSX); $writer->openToFile($resourcePath); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('xlsx--11'), new Cell('xlsx--12') ], $style); @@ -124,7 +116,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase $writer = WriterFactory::create(Type::XLSX); $writer->openToFile($resourcePath); - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('xlsx--11'), new Cell('xlsx--12') ], $style); @@ -465,7 +457,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase { $fileName = 'test_set_default_row_style.xlsx'; - $row = $this->entityFactory->createRow([ + $row = EntityFactory::createRow([ new Cell('xlsx--11') ]); $dataRows = [$row]; @@ -563,7 +555,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase $arrayToRows = function(array $allRows) use ($style) { return array_map(function ($oneRow) use ($style) { - $row = $this->entityFactory->createRow(array_map(function ($value) { + $row = EntityFactory::createRow(array_map(function ($value) { return new Cell($value); }, $oneRow), $style); return $row; @@ -632,7 +624,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase for ($i = 0; $i < count($allRows); $i++) { $currentRow = $allRows[$i]; $currentStyle = $styles[$i]; - $row = $this->entityFactory->createRow(array_map(function ($value) { + $row = EntityFactory::createRow(array_map(function ($value) { return new Cell($value); }, $currentRow), $currentStyle); $writer->addRow($row);