/** * {@inheritDoc} */ public function process() { if ($this->processed) { return; } $this->wizardProcessor->setWizard($this); $output = $this->wizardProcessor->process(); $this->processed = true; if (!$output) { return $this->getViewModel(); } return $output; }
public function testCanRedirectAfterCancel() { $redirectUrl = '/foo'; $request = $this->getHttpRequest(); $params = new Parameters(['cancel' => true]); $request->setPost($params); $response = new HttpResponse(); $wizardProcessor = new WizardProcessor($request, $response); $wizardStub = $this->getWizard(); $wizardProcessor->setWizard($wizardStub); $wizardOptionsStub = $wizardStub->getOptions(); $wizardOptionsStub->method('getCancelUrl')->will($this->returnValue($redirectUrl)); $output = $wizardProcessor->process(); $this->assertInstanceOf('Zend\\Http\\Response', $output); $this->assertEquals(302, $output->getStatusCode()); $headers = $output->getHeaders(); $this->assertEquals($redirectUrl, $headers->get('Location')->getUri()); }