/** * @When /^I use the writer "([^"]*)" and I write the Workbook$/ */ public function iUseTheWriterAndIWriteTheWorkbook($writer) { $styleWorker = new StyleWorker(); $cellWorker = new CellWorker($styleWorker); $labelWorker = new LabelWorker($cellWorker); $tableWorker = new TableWorker($cellWorker, $labelWorker); $writer = new Writer(new Excel5('./features/behat.xls'), $tableWorker, $cellWorker, $styleWorker); // If there isn't Sheet, there is an issue with the export // So, we add one if (0 === $this->workbook->countSheets()) { $this->workbook->addSheet(new Sheet($this->workbook)); } $phpExcel = $writer->convert($this->workbook); $writer->write($phpExcel); $this->excelOutput = (new PHPExcel_Reader_Excel5())->load('./features/behat.xls'); }