With a little luck this will cover a lot.

This commit is contained in:
James Cole
2015-06-07 15:32:01 +02:00
parent 0be5b27d34
commit 596cd09489
7 changed files with 234 additions and 37 deletions

View File

@@ -35,15 +35,8 @@ class Amount
*/
public function getCurrencySymbol()
{
if (defined('FFCURRENCYSYMBOL')) {
return FFCURRENCYSYMBOL; // @codeCoverageIgnore
}
$currencyPreference = Prefs::get('currencyPreference', 'EUR');
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
define('FFCURRENCYSYMBOL', $currency->symbol);
return $currency->symbol;
}
@@ -148,18 +141,12 @@ class Amount
*/
public function getCurrencyCode()
{
if (defined('FFCURRENCYCODE')) {
return FFCURRENCYCODE; // @codeCoverageIgnore
}
$currencyPreference = Prefs::get('currencyPreference', 'EUR');
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
if ($currency) {
define('FFCURRENCYCODE', $currency->code);
return $currency->code;
}

View File

@@ -7,6 +7,7 @@ use Eloquent;
use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag;
use Input;
use RuntimeException;
use Session;
use View;
@@ -109,10 +110,17 @@ class ExpandedForm
$preFilled = Session::get('preFilled');
$value = isset($preFilled[$name]) && is_null($value) ? $preFilled[$name] : $value;
}
if (!is_null(Input::old($name))) {
$value = Input::old($name);
// @codeCoverageIgnoreStart
try {
if (!is_null(Input::old($name))) {
$value = Input::old($name);
}
} catch (RuntimeException $e) {
// don't care about session errors.
}
// @codeCoverageIgnoreEnd
return $value;
}
@@ -249,24 +257,6 @@ class ExpandedForm
return $selectList;
}
/**
* @param $name
* @param null $value
* @param array $options
*
* @return string
*/
public function month($name, $value = null, array $options = [])
{
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
$value = $this->fillFieldValue($name, $value);
$html = View::make('form.month', compact('classes', 'name', 'label', 'value', 'options'))->render();
return $html;
}
/**
* @param $name
* @param array $list
@@ -274,7 +264,6 @@ class ExpandedForm
* @param array $options
*
* @return string
* @internal param null $value
*/
public function multiRadio($name, array $list = [], $selected = null, array $options = [])
{
@@ -297,7 +286,16 @@ class ExpandedForm
*/
public function optionsList($type, $name)
{
$previousValue = Input::old('post_submit_action');
$previousValue = null;
// @codeCoverageIgnoreStart
try {
$previousValue = Input::old('post_submit_action');
} catch (RuntimeException $e) {
// don't care
}
// @codeCoverageIgnoreEnd
$previousValue = is_null($previousValue) ? 'store' : $previousValue;
$html = View::make('form.options', compact('type', 'name', 'previousValue'))->render();