mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-23 09:26:29 -06:00
Expanded test coverage.
This commit is contained in:
parent
13d3d40376
commit
6b0a711395
@ -329,6 +329,8 @@ class GoogleChartController extends BaseController
|
||||
*
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @param int $year
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function budgetsAndSpending(Budget $budget, $year = 0)
|
||||
|
@ -79,9 +79,11 @@ class UserController extends BaseController
|
||||
if ($user) {
|
||||
$result = $email->sendVerificationMail($user);
|
||||
if ($result === false && Config::get('mail.pretend') === false) {
|
||||
// @CodeCoverageIgnoreStart
|
||||
$user->delete();
|
||||
|
||||
return View::make('error')->with('message', 'The email message could not be send. See the log files.');
|
||||
// @CodeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
return View::make('user.verification-pending');
|
||||
|
@ -432,6 +432,7 @@ class TransactionJournal implements TransactionJournalInterface, CUDInterface, C
|
||||
* Returns all objects.
|
||||
*
|
||||
* @return Collection
|
||||
* @throws NotImplementedException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function get()
|
||||
|
@ -37,7 +37,9 @@ class FF3ServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
// @CodeCoverageIgnoreStart
|
||||
return ['reminders', 'filters', 'datekit', 'navigation'];
|
||||
// @CodeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ class Related implements RelatedInterface
|
||||
// get already related transactions:
|
||||
$exclude = [$journal->id];
|
||||
foreach ($journal->transactiongroups()->get() as $group) {
|
||||
foreach ($group->transactionjournals() as $current) {
|
||||
foreach ($group->transactionjournals()->get() as $current) {
|
||||
$exclude[] = $current->id;
|
||||
}
|
||||
}
|
||||
|
@ -243,49 +243,9 @@ class Report implements ReportInterface
|
||||
$start->startOfMonth();
|
||||
$end = clone $date;
|
||||
$end->endOfMonth();
|
||||
$userId = $this->_accounts->getUser()->id;
|
||||
|
||||
return $this->_queries->incomeByPeriod($start, $end);
|
||||
|
||||
// $list = \TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
// ->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')
|
||||
// ->leftJoin(
|
||||
// 'account_meta', function (JoinClause $join) {
|
||||
// $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
|
||||
// }
|
||||
// )
|
||||
// ->transactionTypes(['Deposit'])
|
||||
// ->where('transaction_journals.user_id', $userId)
|
||||
// ->where('transactions.amount', '>', 0)
|
||||
// ->where('transaction_journals.user_id', \Auth::user()->id)
|
||||
// ->where('account_meta.data', '!=', '"sharedExpense"')
|
||||
// ->orderBy('date', 'ASC')
|
||||
// ->before($end)->after($start)->get(['transaction_journals.*']);
|
||||
//
|
||||
// // incoming from a shared account: it's profit (income):
|
||||
// $transfers = \TransactionJournal::withRelevantData()
|
||||
// ->leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
// ->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')
|
||||
// ->leftJoin(
|
||||
// 'account_meta', function (JoinClause $join) {
|
||||
// $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
|
||||
// }
|
||||
// )
|
||||
// ->transactionTypes(['Transfer'])
|
||||
// ->where('transaction_journals.user_id', $userId)
|
||||
// ->where('transactions.amount', '<', 0)
|
||||
// ->where('account_meta.data', '=', '"sharedExpense"')
|
||||
// ->orderBy('date', 'ASC')
|
||||
// ->before($end)->after($start)->get(['transaction_journals.*']);
|
||||
//
|
||||
// $list = $list->merge($transfers);
|
||||
// $list->sort(
|
||||
// function (\TransactionJournal $journal) {
|
||||
// return $journal->date->format('U');
|
||||
// }
|
||||
// );
|
||||
//
|
||||
// return $list;
|
||||
|
||||
}
|
||||
|
||||
|
@ -86,6 +86,7 @@ class Account extends Eloquent
|
||||
/**
|
||||
*
|
||||
* @param EloquentBuilder $query
|
||||
* @param string $field
|
||||
*/
|
||||
public function scopeWithMeta(EloquentBuilder $query, $field = 'accountRole')
|
||||
{
|
||||
|
@ -82,13 +82,19 @@ class TransactionJournal extends Eloquent
|
||||
return ['created_at', 'updated_at', 'date'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescriptionAttribute($value)
|
||||
{
|
||||
if ($this->encrypted) {
|
||||
return Crypt::decrypt($value);
|
||||
}
|
||||
|
||||
// @CodeCoverageIgnoreStart
|
||||
return $value;
|
||||
// @CodeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
/**
|
||||
@ -207,6 +213,9 @@ class TransactionJournal extends Eloquent
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*/
|
||||
public function setDescriptionAttribute($value)
|
||||
{
|
||||
$this->attributes['description'] = Crypt::encrypt($value);
|
||||
|
@ -69,6 +69,21 @@ class TransactionControllerCest
|
||||
|
||||
}
|
||||
|
||||
public function destroyTransferWithEvent(FunctionalTester $I)
|
||||
{
|
||||
// get withdrawal transaction type id:
|
||||
$row = DB::table('piggy_bank_events')->whereNotNull('transaction_journal_id')->first();
|
||||
$journalId = $row->transaction_journal_id;
|
||||
$journal = TransactionJournal::find($journalId);
|
||||
|
||||
$I->wantTo('destroy a transfer connected to a piggy bank');
|
||||
|
||||
$I->amOnPage('/transaction/delete/' . $journal->id);
|
||||
$I->submitForm('#destroy', []);
|
||||
$I->see('Transaction "' . $journal->description . '" destroyed.');
|
||||
|
||||
}
|
||||
|
||||
public function destroyWithdrawal(FunctionalTester $I)
|
||||
{
|
||||
// get withdrawal transaction type id:
|
||||
|
Loading…
Reference in New Issue
Block a user