Fixed tests.

This commit is contained in:
James Cole 2015-06-15 19:25:54 +02:00
parent 620848272e
commit 5e57a390a2
3 changed files with 17 additions and 10 deletions

View File

@ -110,7 +110,7 @@ class Tag extends Model
$journal->tag_count = $count;
$journal->save();
}
parent::save($options);
return parent::save($options);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}