mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-29 02:11:12 -06:00
Covered some more lines of code.
This commit is contained in:
parent
61d60a9048
commit
da0c0742bf
@ -59,15 +59,19 @@ class TransactionJournal extends Eloquent
|
|||||||
*/
|
*/
|
||||||
public function getAmount(\Account $account = null)
|
public function getAmount(\Account $account = null)
|
||||||
{
|
{
|
||||||
|
$amount = 0;
|
||||||
foreach ($this->transactions as $t) {
|
foreach ($this->transactions as $t) {
|
||||||
if (!is_null($account) && $account->id == $t->account_id) {
|
if (!is_null($account) && $account->id == $t->account_id) {
|
||||||
return floatval($t->amount);
|
$amount = floatval($t->amount);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (floatval($t->amount) > 0) {
|
if (floatval($t->amount) > 0) {
|
||||||
return floatval($t->amount);
|
$amount = floatval($t->amount);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,6 +106,17 @@ class TransactionControllerCest
|
|||||||
$I->see(intval($journal->getAmount()));
|
$I->see(intval($journal->getAmount()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function showGroupedJournal(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$journal = TransactionJournal::where('description', 'LIKE', 'Big expense in %')->first();
|
||||||
|
|
||||||
|
|
||||||
|
$I->wantTo('see a grouped transaction');
|
||||||
|
$I->amOnPage('/transaction/show/' . $journal->id);
|
||||||
|
$I->see($journal->description);
|
||||||
|
$I->see('Money for '.$journal->description);
|
||||||
|
}
|
||||||
|
|
||||||
public function store(FunctionalTester $I)
|
public function store(FunctionalTester $I)
|
||||||
{
|
{
|
||||||
$I->wantTo('store a transaction');
|
$I->wantTo('store a transaction');
|
||||||
|
@ -23,12 +23,14 @@ class UserTest extends TestCase
|
|||||||
{
|
{
|
||||||
$pref = f::create('Preference');
|
$pref = f::create('Preference');
|
||||||
$this->assertEquals($pref->user_id, $pref->user->id);
|
$this->assertEquals($pref->user_id, $pref->user->id);
|
||||||
|
$this->assertCount(1, $pref->user->preferences()->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testReminder()
|
public function testReminder()
|
||||||
{
|
{
|
||||||
$reminder = f::create('Reminder');
|
$reminder = f::create('Reminder');
|
||||||
$this->assertEquals($reminder->user_id, $reminder->user->id);
|
$this->assertEquals($reminder->user_id, $reminder->user->id);
|
||||||
|
$this->assertCount(1, $reminder->user->reminders()->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user