Esempio n. 1
0
 /**
  * Test methods
  */
 public function testMethods()
 {
     $form = new Form();
     $step = new WizardStep();
     $step->setStepForm($form);
     $this->assertSame($form, $step->getStepForm());
     $step->setTextDomain('exampleTextDomain');
     $this->assertSame('exampleTextDomain', $step->getTextDomain());
     $step->setDescriptionPartial('exampleDescriptionPartial');
     $this->assertSame('exampleDescriptionPartial', $step->getDescriptionPartial());
     $this->assertFalse($step->canFinishWizard());
     $this->assertTrue($step->canCancelWizard());
     $this->assertFalse($step->canSkip());
     $step->setOption('finish', true);
     $step->setOption('cancel', false);
     $step->setOption('skip', true);
     $this->assertTrue($step->canFinishWizard());
     $this->assertFalse($step->canCancelWizard());
     $this->assertTrue($step->canSkip());
     $this->assertFalse($step->hasPreviousStep());
     $step->setPreviousStep('examplePreviousStep');
     $this->assertSame('examplePreviousStep', $step->getPreviousStep());
     $this->assertTrue($step->hasPreviousStep());
     $this->assertFalse($step->hasNextStep());
     $step->setNextStep('exampleNextStep');
     $this->assertSame('exampleNextStep', $step->getNextStep());
     $this->assertTrue($step->hasNextStep());
 }
Esempio n. 2
0
 /**
  * Get step model
  *
  * @param string $step
  * @return \Core\View\Model\WizardStep
  */
 protected function getStep($step)
 {
     $store = $this->getStore();
     $formSrv = $this->getServiceLocator()->get('Form');
     if ($step == $this->startStep) {
         $form = $formSrv->get('Grid\\Paragraph\\CreateWizard\\Start');
         $model = new StartStep(array('textDomain' => 'paragraph'));
     } else {
         $store['type'] = $step;
         $form = new Form();
         $create = $formSrv->get('Grid\\Paragraph\\Meta\\Create');
         $model = new WizardStep(array('textDomain' => 'paragraph'), array('finish' => true, 'next' => 'finish'));
         if ($create->has($step)) {
             foreach ($create->get($step) as $element) {
                 $form->add($element);
             }
         } else {
             $edit = $formSrv->get('Grid\\Paragraph\\Meta\\Edit');
             if ($edit->has($step)) {
                 foreach ($edit->get($step) as $element) {
                     $form->add($element);
                 }
             } else {
                 $model->setOption('skip', true);
             }
         }
     }
     return $model->setStepForm($form);
 }