Model tests.

This commit is contained in:
James Cole
2014-08-09 19:10:31 +02:00
parent 0967ff9c7f
commit 8eeadffdeb
3 changed files with 126 additions and 6 deletions

View File

@@ -38,14 +38,9 @@ class Component extends Firefly\Database\SingleTableInheritanceEntity
protected $table = 'components';
protected $subclassField = 'class';
public function transactions()
{
return $this->belongsToMany('Transaction');
}
public function limits()
{
return $this->belongsTo('Limit');
return $this->hasMany('Limit');
}
public function transactionjournals()
@@ -53,6 +48,11 @@ class Component extends Firefly\Database\SingleTableInheritanceEntity
return $this->belongsToMany('TransactionJournal');
}
public function transactions()
{
return $this->belongsToMany('Transaction');
}
public function user()
{
return $this->belongsTo('User');

View File

@@ -105,11 +105,14 @@ class Limit extends Ardent
try {
$repetition->save();
\Log::debug('Created new repetition with id #' . $repetition->id);
// @codeCoverageIgnoreStart
} catch (QueryException $e) {
// do nothing
\Log::error('Trying to save new Limitrepetition failed!');
\Log::error($e->getMessage());
}
// @codeCoverageIgnoreEnd
}
}
@@ -118,6 +121,7 @@ class Limit extends Ardent
return $this->hasMany('LimitRepetition');
}
public function getDates()
{
return ['created_at', 'updated_at', 'startdate', 'enddate'];