public function it_creates_an_excel_file_on_flush(ExcelBuilderInterface $builder) { $this->filePath = tempnam('/tmp', 'spec'); $this->setFilePath($this->filePath); unlink($this->filePath); $builder->getExcelObject()->willReturn(new \PHPExcel()); $this->flush(); if (!file_exists($this->filePath)) { throw new \PhpSpec\Exception\Example\FailureException('No created file'); } }
/** * {@inheritdoc} */ public function flush() { $writer = new \PHPExcel_Writer_Excel2007($this->builder->getExcelObject()); $writer->save($this->getPath()); }