public function test() { $arg = []; $path = __DIR__ . '/data/dummy.xlsx'; $strategy1 = $this->createStrategy('test01'); $strategy2 = $this->createStrategy('test02'); $strategy1->expects($this->once())->method('setSelection')->with($this->isInstanceOf(ZipArchive::class), $arg); $strategy2->expects($this->never())->method('setSelection'); $service = new ExcelSelectionSetter(); $service->addStrategy($strategy1); $service->addStrategy($strategy2); $service->execute($path, 'test01', $arg); }
public function test() { $service = new ExcelSelectionSetter(); $service->addStrategy(new AllFirst()); $service->addStrategy(new SynchronizeToTemplate()); $originalFile = __DIR__ . '/data/functional/target.xlsx'; $templateFile = new ZipArchive(); $templateFile->open(__DIR__ . '/data/functional/template.xlsx'); // allfirst $allFirstTarget = __DIR__ . '/data/functional/all_first.xlsx'; copy($originalFile, $allFirstTarget); $service->execute($allFirstTarget, 'all_first'); // synchro $syncTarget = __DIR__ . '/data/functional/sync.xlsx'; copy($originalFile, $syncTarget); $service->execute($syncTarget, 'synchronize_to_template', $templateFile); $this->assertTrue(true); }