mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-27 11:20:39 -06:00
Expanded some tests.
This commit is contained in:
parent
c10efbb170
commit
54c6ca9f45
@ -74,7 +74,9 @@ class ReportQuery implements ReportQueryInterface
|
||||
if ($journal->amount != 0) {
|
||||
return $journal;
|
||||
}
|
||||
// @codeCoverageIgnoreStart
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
);
|
||||
|
||||
return $data;
|
||||
@ -191,7 +193,9 @@ class ReportQuery implements ReportQueryInterface
|
||||
if ($journal->amount != 0) {
|
||||
return $journal;
|
||||
}
|
||||
// @codeCoverageIgnoreStart
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
);
|
||||
|
||||
return $data;
|
||||
@ -237,14 +241,11 @@ class ReportQuery implements ReportQueryInterface
|
||||
Auth::user()->transactionjournals()
|
||||
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('transactions.amount', '<', 0)
|
||||
->transactionTypes(['Withdrawal'])
|
||||
->where('transactions.account_id', $account->id)
|
||||
->before($end)
|
||||
->after($start)
|
||||
->whereNull('budget_transaction_journal.budget_id')
|
||||
->sum('transactions.amount')
|
||||
);
|
||||
->whereNull('budget_transaction_journal.budget_id')->get(['transaction_journals.*'])->sum('amount'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,8 +148,8 @@ class Cleanup
|
||||
}
|
||||
unset($set, $entry, $metadata);
|
||||
|
||||
|
||||
//encrypt budget limit amount
|
||||
|
||||
//encrypt limit repetition amount
|
||||
//encrypt piggy bank event amount
|
||||
//encrypt piggy bank repetition currentamount
|
||||
|
@ -192,7 +192,7 @@ FactoryMuffin::define(
|
||||
return RandomString::generateRandomString(3);
|
||||
},
|
||||
'symbol' => function () {
|
||||
return RandomString::generateRandomString(1);
|
||||
return RandomString::generateRandomString(2);
|
||||
},
|
||||
'name' => 'word'
|
||||
]
|
||||
|
@ -70,6 +70,7 @@ class ReportHelperTest extends TestCase
|
||||
* @covers FireflyIII\Helpers\Report\ReportHelper::getBalanceReport
|
||||
* @covers FireflyIII\Helpers\Report\ReportQuery::getAllAccounts
|
||||
* @covers FireflyIII\Helpers\Report\ReportQuery::spentInBudgetCorrected
|
||||
* @covers FireflyIII\Helpers\Report\ReportQuery::spentNoBudget
|
||||
*/
|
||||
public function testGetBalanceReport()
|
||||
{
|
||||
|
@ -36,6 +36,22 @@ class BillRepositoryTest extends TestCase
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testBillPaymentsInRange()
|
||||
{
|
||||
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
|
||||
$start = Carbon::now()->startOfMonth();
|
||||
$end = Carbon::now()->endOfMonth();
|
||||
|
||||
// payment:
|
||||
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
|
||||
$journal->date = $start;
|
||||
$journal->bill_id = $bill->id;
|
||||
$journal->save();
|
||||
|
||||
|
||||
$this->object->billPaymentsInRange($bill, $start, $end);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Bill\BillRepository::createFakeBill
|
||||
*/
|
||||
@ -58,8 +74,8 @@ class BillRepositoryTest extends TestCase
|
||||
*/
|
||||
public function testDestroy()
|
||||
{
|
||||
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
|
||||
$accountId = $bill->id;
|
||||
$bill = FactoryMuffin::create('FireflyIII\Models\Bill');
|
||||
$accountId = $bill->id;
|
||||
$this->object->destroy($bill);
|
||||
|
||||
// cannot find bill:
|
||||
@ -284,6 +300,7 @@ class BillRepositoryTest extends TestCase
|
||||
/**
|
||||
* One
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*
|
||||
* @covers FireflyIII\Repositories\Bill\BillRepository::scan
|
||||
*/
|
||||
public function testScanMatch()
|
||||
|
@ -295,7 +295,18 @@ class BudgetRepositoryTest extends TestCase
|
||||
{
|
||||
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
|
||||
|
||||
$amount = $this->object->spentInPeriodCorrected($budget, new Carbon, new Carbon);
|
||||
$amount = $this->object->spentInPeriodCorrected($budget, new Carbon, new Carbon, false);
|
||||
$this->assertEquals(0, $amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Budget\BudgetRepository::spentInPeriodCorrected
|
||||
*/
|
||||
public function testSpentInPeriodCorrectedShared()
|
||||
{
|
||||
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
|
||||
|
||||
$amount = $this->object->spentInPeriodCorrected($budget, new Carbon, new Carbon, true);
|
||||
$this->assertEquals(0, $amount);
|
||||
}
|
||||
|
||||
|
@ -99,6 +99,15 @@ class CategoryRepositoryTest extends TestCase
|
||||
$category->save();
|
||||
}
|
||||
|
||||
// another journal, same category:
|
||||
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
|
||||
$journal->user_id = $user->id;
|
||||
$journal->date = new Carbon('2015-02-11');
|
||||
$journal->transaction_type_id = $type->id;
|
||||
$category->transactionjournals()->save($journal);
|
||||
$journal->save();
|
||||
$category->save();
|
||||
|
||||
$this->be($user);
|
||||
$set = $this->object->getCategoriesAndExpensesCorrected(new Carbon('2015-02-01'), new Carbon('2015-02-28'));
|
||||
$this->assertCount(5, $set);
|
||||
@ -196,7 +205,20 @@ class CategoryRepositoryTest extends TestCase
|
||||
public function testSpentInPeriodSumCorrected()
|
||||
{
|
||||
$category = FactoryMuffin::create('FireflyIII\Models\Category');
|
||||
$sum = $this->object->spentInPeriodCorrected($category, new Carbon, new Carbon);
|
||||
$sum = $this->object->spentInPeriodCorrected($category, new Carbon, new Carbon, false);
|
||||
|
||||
$this->assertEquals(0, $sum);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Category\CategoryRepository::spentInPeriodCorrected
|
||||
*/
|
||||
public function testSpentInPeriodSumCorrectedShared()
|
||||
{
|
||||
$category = FactoryMuffin::create('FireflyIII\Models\Category');
|
||||
$sum = $this->object->spentInPeriodCorrected($category, new Carbon, new Carbon, true);
|
||||
|
||||
$this->assertEquals(0, $sum);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user