StyleMerger and RowManager changes

Move DI of StyleMerger to get rid of business logic in the entities Cell and Row
Simplify RowManager
This commit is contained in:
Adrien Loison committed 2017-11-10 22:45:57 +01:00
1 parent 111f82d35f
commit ddfa40e8b3
10 files changed
+67 -166

No files matched your search

+6 -18
View File
@@ -3,7 +3,6 @@
namespace Box\Spout\Writer\Common\Entity;
use Box\Spout\Writer\Common\Entity\Style\Style;
use Box\Spout\Writer\Common\Manager\RowManager;
use PHPUnit\Framework\TestCase;
class RowTest extends TestCase
@@ -24,23 +23,12 @@ class RowTest extends TestCase
return $this->createMock(Cell::class);
}
/**
* @return \PHPUnit_Framework_MockObject_MockObject|RowManager
*/
private function getRowManagerMock()
{
return $this->createMock(RowManager::class);
}
/**
* @return void
*/
public function testValidInstance()
{
$this->assertInstanceOf(
Row::class,
new Row([], null, $this->getRowManagerMock())
);
$this->assertInstanceOf(Row::class, new Row([], null));
}
/**
@@ -48,7 +36,7 @@ class RowTest extends TestCase
*/
public function testSetCells()
{
$row = new Row([], null, $this->getRowManagerMock());
$row = new Row([], null);
$row->setCells([$this->getCellMock(), $this->getCellMock()]);
$this->assertEquals(2, count($row->getCells()));
@@ -59,7 +47,7 @@ class RowTest extends TestCase
*/
public function testSetCellsResets()
{
$row = new Row([], null, $this->getRowManagerMock());
$row = new Row([], null);
$row->setCells([$this->getCellMock(), $this->getCellMock()]);
$this->assertEquals(2, count($row->getCells()));
@@ -74,7 +62,7 @@ class RowTest extends TestCase
*/
public function testGetCells()
{
$row = new Row([], null, $this->getRowManagerMock());
$row = new Row([], null);
$this->assertEquals(0, count($row->getCells()));
@@ -88,7 +76,7 @@ class RowTest extends TestCase
*/
public function testAddCell()
{
$row = new Row([], null, $this->getRowManagerMock());
$row = new Row([], null);
$row->setCells([$this->getCellMock(), $this->getCellMock()]);
$this->assertEquals(2, count($row->getCells()));
@@ -103,7 +91,7 @@ class RowTest extends TestCase
*/
public function testFluentInterface()
{
$row = new Row([], null, $this->getRowManagerMock());
$row = new Row([], null);
$row
->addCell($this->getCellMock())
->setStyle($this->getStyleMock())