public function setUp() { $this->testfile = __DIR__ . '/resources/FileWriterTest.csv'; $this->streamer = Mockery::mock('\\Oracle\\Export\\FlatFileStreamer'); $this->streamer->shouldReceive('getFilename')->once()->andReturn($this->testfile); $this->streamer->shouldReceive('getType')->once()->andReturn('csv'); $this->streamer->shouldReceive('getHeadersLine')->once()->andReturn("name,age,city\r\n"); $this->streamer->shouldReceive('next')->times(4)->andReturn("John,24,Amsterdam\r\n", "Piet,24,Den Haag\r\n", "Kees,30,Rotterdam\r\n", false); $this->writer = new FlatFileWriter($this->streamer); }
protected function writeHeadersIfRequired() { if ($this->showHeaders) { fwrite($this->handle, $this->streamer->getHeadersLine()); } }