/** * @param array $expected * @param $withSampleData * * @dataProvider indexActionDataProvider */ public function testIndexAction($expected, $withSampleData) { if ($withSampleData) { $this->moduleList->expects($this->once())->method('has')->willReturn(true); $this->objectManager->expects($this->once())->method('get')->willReturn($this->sampleDataState); $this->sampleDataState->expects($this->once())->method('isInstalled')->willReturn($expected['isSampleDataInstalled']); $this->sampleDataState->expects($this->once())->method('hasError')->willReturn($expected['isSampleDataErrorInstallation']); } else { $this->moduleList->expects($this->once())->method('has')->willReturn(false); $this->objectManager->expects($this->never())->method('get'); } $this->lists->expects($this->once())->method('getTimezoneList')->willReturn($expected['timezone']); $this->lists->expects($this->once())->method('getCurrencyList')->willReturn($expected['currency']); $this->lists->expects($this->once())->method('getLocaleList')->willReturn($expected['language']); $viewModel = $this->controller->indexAction(); $this->assertInstanceOf('Zend\\View\\Model\\ViewModel', $viewModel); $this->assertTrue($viewModel->terminate()); $variables = $viewModel->getVariables(); $this->assertArrayHasKey('timezone', $variables); $this->assertArrayHasKey('currency', $variables); $this->assertArrayHasKey('language', $variables); $this->assertSame($expected, $variables); }