Exemple #1
0
 /**
  * @test
  * @covers Sylius\Bundle\FlowBundle\Process\Coordinator\Coordinator::forward
  */
 public function shouldDoProcessRedirectWhenLastStepIsCompleted()
 {
     $router = $this->getRouter('http://localhost/processRedirect', array(), 'http://localhost/processRedirect');
     $processBuilder = $this->getProcessBuilder($this->getProcess());
     $processContext = $this->getProcessContext();
     $processContext->expects($this->any())->method('isValid')->will($this->returnValue(true));
     $processContext->expects($this->any())->method('isCompleted')->will($this->returnValue(true));
     $processContext->expects($this->once())->method('close');
     $processContext->expects($this->once())->method('isLastStep')->will($this->returnValue(true));
     $this->coordinator = $this->createCoordinator($router, $processBuilder, $processContext);
     $this->coordinator->registerScenario('scenarioOne', $this->getMock('Sylius\\Bundle\\FlowBundle\\Process\\Scenario\\ProcessScenarioInterface'));
     $response = $this->coordinator->forward('scenarioOne', 'someStepName');
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $response);
     $this->assertEquals('http://localhost/processRedirect', $response->getTargetUrl());
 }
 /**
  * Execute continue action of given step.
  *
  * @param Request $request
  * @param string  $scenarioAlias
  * @param string  $stepName
  *
  * @return Response
  */
 public function forwardAction(Request $request, $scenarioAlias, $stepName)
 {
     $this->processContext->setRequest($request);
     return $this->processCoordinator->forward($scenarioAlias, $stepName);
 }