Exemplo n.º 1
0
 public function testGetFormWhenCurrentStepIsTheFirstShouldRemovePreviousAndValidButton()
 {
     $wizard = new Wizard();
     $wizard->setIdentifierAccessor($this->getIdentifierAccessor());
     $formMock = $this->getMock('Zend\\Form\\Form');
     $formMock->expects($this->exactly(2))->method('remove')->with($this->logicalOr($this->equalTo('previous'), $this->equalTo('valid')));
     $formFactoryStub = $this->getMock('Wizard\\Form\\FormFactory');
     $formFactoryStub->method('create')->will($this->returnValue($formMock));
     $wizard->setFormFactory($formFactoryStub);
     $steps = $wizard->getSteps();
     $steps->add($this->getStep('foo'));
     $steps->add($this->getStep('bar'));
     $wizard->getForm();
 }
Exemplo n.º 2
0
 /**
  * @param  ServiceLocatorInterface $serviceLocator
  * @return Wizard
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     /* @var $wizard \Wizard\WizardInterface */
     $wizard = new Wizard();
     $formFactory = $serviceLocator->get('Wizard\\Form\\FormFactory');
     $wizard->setFormFactory($formFactory);
     $wizardProcessor = $serviceLocator->get('Wizard\\WizardProcessor');
     $wizard->setWizardProcessor($wizardProcessor);
     $identifierAccessor = $serviceLocator->get('Wizard\\Wizard\\IdentifierAccessor');
     $wizard->setIdentifierAccessor($identifierAccessor);
     $wizardListener = $serviceLocator->get('Wizard\\Listener\\WizardListener');
     $wizard->getEventManager()->attachAggregate($wizardListener);
     $stepCollection = $wizard->getSteps();
     $stepCollectionListener = $serviceLocator->get('Wizard\\Listener\\StepCollectionListener');
     $stepCollection->getEventManager()->attachAggregate($stepCollectionListener);
     return $wizard;
 }