mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-28 09:51:21 -06:00
Fixed tests.
This commit is contained in:
parent
620848272e
commit
5e57a390a2
@ -110,7 +110,7 @@ class Tag extends Model
|
||||
$journal->tag_count = $count;
|
||||
$journal->save();
|
||||
}
|
||||
parent::save($options);
|
||||
return parent::save($options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -214,6 +214,15 @@ class TransactionJournal extends Model
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
*/
|
||||
public function tags()
|
||||
{
|
||||
return $this->belongsToMany('FireflyIII\Models\Tag');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $amount
|
||||
*
|
||||
@ -279,16 +288,8 @@ class TransactionJournal extends Model
|
||||
{
|
||||
$count = $this->tags()->count();
|
||||
$this->tag_count = $count;
|
||||
parent::save($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
*/
|
||||
public function tags()
|
||||
{
|
||||
return $this->belongsToMany('FireflyIII\Models\Tag');
|
||||
return parent::save($options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -109,6 +109,9 @@ class TransactionJournalModelTest extends TestCase
|
||||
$tag->transactionJournals()->save($withdrawal);
|
||||
$tag->transactionJournals()->save($deposit);
|
||||
|
||||
$withdrawal->save();
|
||||
$deposit->save();
|
||||
|
||||
// amount should be 210.12:
|
||||
$this->assertEquals('210.12', $withdrawal->amount);
|
||||
$this->assertEquals('0', $deposit->amount);
|
||||
@ -175,8 +178,11 @@ class TransactionJournalModelTest extends TestCase
|
||||
$transfer->transactions[1]->amount = 123.45;
|
||||
$transfer->transactions[1]->save();
|
||||
|
||||
$withdrawal->save();
|
||||
$amount = $withdrawal->amount;
|
||||
|
||||
|
||||
|
||||
$this->assertEquals('0', $amount);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user