Tests for budget controller.

This commit is contained in:
James Cole
2014-08-02 15:23:29 +02:00
parent 913b5fd267
commit 30b589d040
8 changed files with 352 additions and 190 deletions

View File

@@ -12,6 +12,13 @@ use Carbon\Carbon;
class EloquentBudgetRepository implements BudgetRepositoryInterface
{
public function destroy(\Budget $budget)
{
$budget->delete();
return true;
}
/**
* @param $budgetId
*
@@ -46,37 +53,6 @@ class EloquentBudgetRepository implements BudgetRepositoryInterface
return $set;
}
/**
* @param $data
*
* @return mixed
*/
public function update($data)
{
$budget = $this->find($data['id']);
if ($budget) {
// update account accordingly:
$budget->name = $data['name'];
if ($budget->validate()) {
$budget->save();
}
}
return $budget;
}
public function destroy($budgetId)
{
$budget = $this->find($budgetId);
if ($budget) {
$budget->delete();
return true;
}
return false;
}
/**
* @return array|mixed
*/
@@ -161,4 +137,20 @@ class EloquentBudgetRepository implements BudgetRepositoryInterface
return $budget;
}
/**
* @param $data
*
* @return mixed
*/
public function update(\Budget $budget, $data)
{
// update account accordingly:
$budget->name = $data['name'];
if ($budget->validate()) {
$budget->save();
}
return $budget;
}
}