Model tests now cover models 100%.

This commit is contained in:
James Cole 2014-07-15 21:10:51 +02:00
parent 9687b5fb33
commit 473e0f81c9

View File

@ -1,6 +1,6 @@
<?php
use \League\FactoryMuffin\Facade\FactoryMuffin;
use League\FactoryMuffin\Facade\FactoryMuffin;
class AllModelsTest extends TestCase
{
@ -54,7 +54,7 @@ class AllModelsTest extends TestCase
// test pref?
$pref->data = 'Blabla';
$this->assertEquals($pref->data,'Blabla');
$this->assertEquals($pref->data, 'Blabla');
$this->assertCount(1, $user->accounts()->get());
$this->assertCount(1, $user->preferences()->get());
@ -152,10 +152,21 @@ class AllModelsTest extends TestCase
$type->accounts()->save($a1);
$type->accounts()->save($a2);
$a1->accounttype()->associate($type);
$this->assertEquals($a1->account_type_id, $type->id);
$this->assertCount(2, $type->accounts()->get());
}
public function testBalance()
{
$account = FactoryMuffin::create('Account');
$this->assertEquals(0.0, $account->balance());
}
public function testTransactions()
{
$transaction = FactoryMuffin::create('Transaction');
@ -170,6 +181,10 @@ class AllModelsTest extends TestCase
$transaction->account()->associate($account);
$transaction->transactionjournal()->associate($journal);
$account->transactions()->save($transaction);
$this->assertEquals($transaction->account_id, $account->id);
$this->assertCount(1, $transaction->transactionjournal()->get());
$this->assertCount(1, $transaction->account()->get());
$this->assertCount(2, $transaction->components()->get());
@ -193,6 +208,7 @@ class AllModelsTest extends TestCase
$this->assertCount(1, $component->user()->get());
$this->assertCount(1, $component->transactions()->get());
}
public function tearDown()
{
Mockery::close();