This should fix the tests.

This commit is contained in:
James Cole 2015-06-23 22:13:13 +02:00
parent cd27f0ad69
commit 124c9303b9
5 changed files with 27 additions and 14 deletions

View File

@ -297,7 +297,7 @@ class PiggyBankController extends Controller
*/
public function show(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
$events = $repository->getEvents($piggyBank);
$events = $repository->getEvents($piggyBank);
$subTitle = e($piggyBank->name);
return view('piggy-banks.show', compact('piggyBank', 'events', 'subTitle'));
@ -314,11 +314,13 @@ class PiggyBankController extends Controller
{
$piggyBankData = [
'name' => $request->get('name'),
'startdate' => new Carbon,
'account_id' => intval($request->get('account_id')),
'targetamount' => floatval($request->get('targetamount')),
'targetdate' => strlen($request->get('targetdate')) > 0 ? new Carbon($request->get('targetdate')) : null,
'name' => $request->get('name'),
'startdate' => new Carbon,
'account_id' => intval($request->get('account_id')),
'targetamount' => floatval($request->get('targetamount')),
'remind_me' => false,
'reminder_skip' => 0,
'targetdate' => strlen($request->get('targetdate')) > 0 ? new Carbon($request->get('targetdate')) : null,
];
$piggyBank = $repository->store($piggyBankData);
@ -347,11 +349,13 @@ class PiggyBankController extends Controller
public function update(PiggyBankRepositoryInterface $repository, PiggyBankFormRequest $request, PiggyBank $piggyBank)
{
$piggyBankData = [
'name' => $request->get('name'),
'startdate' => is_null($piggyBank->startdate) ? $piggyBank->created_at : $piggyBank->startdate,
'account_id' => intval($request->get('account_id')),
'targetamount' => floatval($request->get('targetamount')),
'targetdate' => strlen($request->get('targetdate')) > 0 ? new Carbon($request->get('targetdate')) : null,
'name' => $request->get('name'),
'startdate' => is_null($piggyBank->startdate) ? $piggyBank->created_at : $piggyBank->startdate,
'account_id' => intval($request->get('account_id')),
'targetamount' => floatval($request->get('targetamount')),
'remind_me' => false,
'reminder_skip' => 0,
'targetdate' => strlen($request->get('targetdate')) > 0 ? new Carbon($request->get('targetdate')) : null,
];
$piggyBank = $repository->update($piggyBank, $piggyBankData);

View File

@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class PiggyBank
*
* @codeCoverageIgnore
* @codeCoverageIgnore
* @package FireflyIII\Models
* @property integer $id
* @property \Carbon\Carbon $created_at
@ -43,7 +43,7 @@ class PiggyBank extends Model
use SoftDeletes;
protected $fillable
= ['name', 'account_id', 'order', 'targetamount', 'startdate', 'targetdate'];
= ['name', 'account_id', 'order', 'targetamount', 'startdate', 'targetdate', 'remind_me', 'reminder_skip'];
protected $hidden = ['targetamount_encrypted', 'encrypted'];
/**

View File

@ -116,7 +116,10 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
*/
public function store(array $data)
{
$piggyBank = PiggyBank::create($data);
$data['remind_me'] = false;
$data['reminder_skip'] = 0;
$piggyBank = PiggyBank::create($data);
return $piggyBank;
}

View File

@ -237,6 +237,8 @@ FactoryMuffin::define(
},
'startdate' => 'date',
'targetdate' => 'date',
'remind_me' => false,
'reminder_skip' => 0,
'order' => 0,
]
);

View File

@ -138,6 +138,8 @@ class PiggyBankRepositoryTest extends TestCase
'name' => 'Some piggy',
'targetamount' => 100,
'order' => 1,
'remind_me' => false,
'reminder_skip' => 0,
];
@ -161,6 +163,8 @@ class PiggyBankRepositoryTest extends TestCase
'targetamount' => 100,
'create_another' => 1,
'order' => 1,
'remind_me' => false,
'reminder_skip' => 0,
];