mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Tests for budget controller.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user