public function testCreateStepWithFormOptionShouldSetFormInstance() { $stepOptions = ['form' => 'App\\Step\\FooForm']; $formStub = $this->getMock('Zend\\Form\\Form'); $stepMock = $this->getStep(); $stepMock->expects($this->once())->method('setForm')->with($formStub); $stepPluginManagerStub = $this->getStepPluginManager(); $stepPluginManagerStub->method('get')->will($this->returnValue($stepMock)); $formElementManagerStub = $this->getFormPluginManager(); $formElementManagerStub->method('get')->with($stepOptions['form'])->will($this->returnValue($formStub)); $stepFactory = new StepFactory($stepPluginManagerStub, $formElementManagerStub); $stepFactory->create('foo', $stepOptions); }
/** * @param array $steps * @param Wizard $wizard */ protected function addSteps(array $steps, Wizard $wizard) { foreach ($steps as $key => $values) { $step = $this->stepFactory->create($key, $values); if (!$step) { continue; } $step->setWizard($wizard)->init(); $wizard->getSteps()->add($step); } }