Fixes and tests for transactions.

This commit is contained in:
James Cole
2014-07-09 13:45:27 +02:00
parent 61f7fbe951
commit 3fc793f014
3 changed files with 24 additions and 3 deletions

View File

@@ -35,10 +35,15 @@ class AllModelsTest extends TestCase
$account->user()->associate($user);
$pref->user()->associate($user);
$user->accounts()->save($account);
$user->preferences()->save($pref);
$this->assertEquals($account->user_id, $user->id);
$this->assertEquals($pref->user_id,$user->id);
$this->assertCount(1, $user->accounts()->get());
$this->assertCount(1, $user->preferences()->get());
$this->assertTrue(true);
@@ -49,6 +54,7 @@ class AllModelsTest extends TestCase
*/
public function testUserAccounts()
{
$this->assertTrue(true);
}
@@ -84,4 +90,20 @@ class AllModelsTest extends TestCase
$this->assertEquals($tj->transaction_currency_id,$tj->transactionCurrency()->first()->id);
}
public function testTransactions() {
$transaction = FactoryMuff::create('Transaction');
$budget = FactoryMuff::create('Budget');
$category = FactoryMuff::create('Category');
$transaction->components()->save($budget);
$transaction->components()->save($category);
$this->assertCount(2,$transaction->components()->get());
$this->assertCount(1,$transaction->budgets()->get());
$this->assertCount(1,$transaction->categories()->get());
}
}