/** * Display a failure page * * @param bool $allowRapid Whether to allow rendering a RapidFail form * renderForm sets this to false on failure to avoid an infinite loop */ public function displayFailPage($allowRapid = true) { $output = $this->getOutput(); if ($this->adapter && $allowRapid) { $page = ResultPages::getFailPage($this->adapter); if (!filter_var($page, FILTER_VALIDATE_URL)) { // If it's not a URL, we're rendering a RapidFail form $this->logger->info("Displaying fail form {$page}"); $this->adapter->addRequestData(array('ffname' => $page)); $this->displayForm(); return; } } else { $gatewayName = $this->getGatewayIdentifier(); $className = DonationInterface::getAdapterClassForGateway($gatewayName); $page = ResultPages::getFailPageForType($className, $this->getLogPrefix()); } $log_message = "Redirecting to [{$page}]"; $this->logger->info($log_message); $output->redirect($page); }
public function testGetFailPageForType() { $url = ResultPages::getFailPageForType('GlobalCollectAdapter'); $expectedTitle = Title::newFromText('Donate-error'); $expectedURL = wfAppendQuery($expectedTitle->getFullURL(), 'uselang=en'); $this->assertEquals($expectedURL, $url); }