private function renderWidgetObj(Widget $widget) { $vars = array(); $vars['previewOnly'] = false; $vars['display'] = at($_GET, 'display', 'overview'); $vars['widgetID'] = $widget->id; $vars['width'] = $widget->width; $vars['height'] = $widget->height; $vars['color'] = $widget->color; $vars['title'] = $widget->title; $vars['about'] = $widget->about; $vars['currency'] = $widget->currency; $vars['goal'] = $widget->goalAmnt; $vars['raised'] = $widget->raisedAmnt; $vars['lastBalance'] = $widget->raisedSatoshis; $vars['progressPercent'] = $widget->progressPercent; $this->setAltCurrencyValues($widget->goalAmnt, $widget->raisedAmnt, $vars); $vars['bitcoinAddress'] = $widget->bitcoinAddress; $vars['checkProgressURI'] = Routes\checkWidgetProgress($widget); $vars['checkBalanceURI'] = BlockchainDotInfo\balanceLookupURL($widget->bitcoinAddress); $vars['amountRaisedURI'] = Routes\amountRaised($widget); return $this->renderWidgetArr($vars); }
/** * In the case that there's some sort of communication problem with attempting to check * the given Bitcoin-address balance (via Blockchain.info), we want to make sure that * does not lead to an exception reaching the top level. */ function testActionForCheckingWidgetProgressViaJavascriptElegantlyHandlesNetworkError() { $w = getWidget(); $w->bitcoinAddress = '1AkZUyVHtVsU6ZmAu1iSDhYiXbqFgKqzbt'; $w->save(); try { $this->get(Routes\checkWidgetProgress($w)); } catch (UnexpectedHttpResponseCode $_) { /* We'll accept that. */ } }