/** * {@inheritdoc} */ public function write(array $items) { parent::write($items); if ($this->clearWriter) { $this->clearWriter->write($items); } }
public function testWrite() { $entityManager = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock(); $entityManager->expects($this->once())->method('clear'); $writer = new DoctrineClearWriter($entityManager); $writer->write(array()); }
public function testWrite() { $entityManager = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock(); /** @var \PHPUnit_Framework_MockObject_MockObject|ManagerRegistry $registry */ $registry = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry'); $registry->expects($this->once())->method('getManager')->willReturn($entityManager); $entityManager->expects($this->once())->method('clear'); $writer = new DoctrineClearWriter($registry); $writer->write(array()); }
/** * {@inheritdoc} */ public function write(array $items) { if (!$this->header && count($items) > 0) { $this->header = array_keys($items[0]); } $this->writeHeader(); foreach ($items as $item) { $this->writeCsv($item); } $this->close(); if ($this->clearWriter) { $this->clearWriter->write($items); } }