/**
  * @param string $xmlFixtureFile
  * @param string $expect
  * @dataProvider provideData
  */
 public function test($xmlFixtureFile, $expect)
 {
     $xml = file_get_contents(__DIR__ . '/../../data/xml/' . $xmlFixtureFile);
     $zip = $this->getMockBuilder(ZipArchive::class)->disableOriginalConstructor()->getMock();
     $zip->expects($this->atLeastOnce())->method('getFromName')->with('xl/workbook.xml')->will($this->returnValue($xml));
     $reader = new SheetSelectionReader();
     $this->assertEquals($expect, $reader->read($zip));
 }
 /**
  * @param ZipArchive $xlsx
  * @param ZipArchive|null $template
  */
 public function setSelection(ZipArchive $xlsx, ZipArchive $template = null)
 {
     if (!$template instanceof ZipArchive) {
         throw new \RuntimeException('Invalid template');
     }
     // テンプレートで選択されているシートを取得
     $selectedSheet = $this->sheetReader->read($template);
     // テンプレートの各シートで選択されているセルを取得
     $sheets = $this->bookUtil->makeSheetMap($template);
     $selectedCells = [];
     foreach ($sheets as $sheetId => $sheetName) {
         $selectedCells[$sheetName] = $this->cellReader->read($template, $sheetName);
     }
     // 選択シートを書き込む
     $this->sheetSetter->set($xlsx, $selectedSheet);
     // 各シートの選択セルを書き込む
     foreach ($selectedCells as $sheetName => $cellPosition) {
         $this->cellSetter->set($xlsx, $sheetName, $cellPosition);
     }
 }