mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Model tests now cover models 100%.
This commit is contained in:
parent
9687b5fb33
commit
473e0f81c9
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user