From 473e0f81c9dc9eec4194b0737f6d1e293945aeb9 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 15 Jul 2014 21:10:51 +0200 Subject: [PATCH] Model tests now cover models 100%. --- app/tests/models/AllModelsTest.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/app/tests/models/AllModelsTest.php b/app/tests/models/AllModelsTest.php index a98e11e2e1..caf0bcf927 100644 --- a/app/tests/models/AllModelsTest.php +++ b/app/tests/models/AllModelsTest.php @@ -1,6 +1,6 @@ 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();