object = new Spreadsheet(); $sheet = $this->object->getActiveSheet(); $sheet->setTitle('someSheet1'); $sheet = new Worksheet(); $sheet->setTitle('someSheet2'); $this->object->addSheet($sheet); $sheet = new Worksheet(); $sheet->setTitle('someSheet 3'); $this->object->addSheet($sheet); } /** * @return array */ public function dataProviderForSheetNames() { $array = [ [0, 'someSheet1'], [0, "'someSheet1'"], [1, 'someSheet2'], [1, "'someSheet2'"], [2, 'someSheet 3'], [2, "'someSheet 3'"], ]; return $array; } /** * @param $index * @param $sheetName * * @dataProvider dataProviderForSheetNames */ public function testGetSheetByName($index, $sheetName): void { self::assertEquals($this->object->getSheet($index), $this->object->getSheetByName($sheetName)); } }