mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Tests fixed.
This commit is contained in:
parent
12ae548dab
commit
de1bf42f94
@ -491,6 +491,68 @@ class TransactionControllerTest extends TestCase
|
||||
$this->assertRedirectedToRoute('transactions.create',['what' => 'transfer']);
|
||||
}
|
||||
|
||||
public function testShow() {
|
||||
$journal = FactoryMuffin::create('TransactionJournal');
|
||||
|
||||
// mock transaction journal:
|
||||
$tj = $this->mock('Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface');
|
||||
$tj->shouldReceive('find')->with($journal->id)->andReturn($journal);
|
||||
|
||||
|
||||
|
||||
// call
|
||||
$this->call('GET', '/transaction/show/' . $journal->id);
|
||||
|
||||
// test
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
public function testShowError() {
|
||||
|
||||
// mock transaction journal:
|
||||
$tj = $this->mock('Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface');
|
||||
$tj->shouldReceive('find')->with(1)->andReturn(null);
|
||||
|
||||
// call
|
||||
$this->call('GET', '/transaction/show/1');
|
||||
|
||||
// test
|
||||
$this->assertResponseOk();
|
||||
$this->assertViewHas('message');
|
||||
}
|
||||
|
||||
public function testEdit() {
|
||||
$journal = FactoryMuffin::create('TransactionJournal');
|
||||
|
||||
// mock transaction journal:
|
||||
$tj = $this->mock('Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface');
|
||||
$tj->shouldReceive('find')->with($journal->id)->andReturn($journal);
|
||||
|
||||
// mock account repository
|
||||
$accounts = $this->mock('Firefly\Storage\Account\AccountRepositoryInterface');
|
||||
$accounts->shouldReceive('getActiveDefaultAsSelectList')->andReturn([]);
|
||||
|
||||
|
||||
|
||||
// call
|
||||
$this->call('GET', '/transaction/edit/' . $journal->id);
|
||||
|
||||
// test
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
public function testEditError() {
|
||||
// mock transaction journal:
|
||||
$tj = $this->mock('Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface');
|
||||
$tj->shouldReceive('find')->with(1)->andReturn(null);
|
||||
|
||||
// call
|
||||
$this->call('GET', '/transaction/edit/1');
|
||||
|
||||
// test
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
Mockery::close();
|
||||
|
@ -85,6 +85,7 @@ class AllModelsTest extends TestCase
|
||||
$t1 = FactoryMuffin::create('Transaction');
|
||||
$t2 = FactoryMuffin::create('Transaction');
|
||||
$t3 = FactoryMuffin::create('Transaction');
|
||||
$user = FactoryMuffin::create('User');
|
||||
|
||||
$tj->transactions()->save($t1);
|
||||
$tj->transactions()->save($t2);
|
||||
@ -95,10 +96,13 @@ class AllModelsTest extends TestCase
|
||||
|
||||
$tj->components()->save($budget);
|
||||
$tj->components()->save($category);
|
||||
$user->transactionjournals()->save($tj);
|
||||
|
||||
$this->assertCount(2, $tj->components()->get());
|
||||
$this->assertCount(1, $tj->budgets()->get());
|
||||
$this->assertCount(1, $tj->categories()->get());
|
||||
$this->assertCount(1, $user->transactionjournals()->get());
|
||||
|
||||
|
||||
$this->assertCount(3, $tj->transactions()->get());
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@if(\Auth::user() && \Auth::check())
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li @if($r=='preferences')class="active"@endif><a href="{{route('preferences')}}"><span class="glyphicon glyphicon-cog"></span> Preferences</a></li>
|
||||
<li class="dropdown">
|
||||
@ -22,4 +22,5 @@
|
||||
<li><a href="{{route('logout')}}"><span class="glyphicon glyphicon-arrow-right"></span> Logout</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
@endif
|
Loading…
Reference in New Issue
Block a user