First attempt at account controller::index.

This commit is contained in:
James Cole 2015-04-03 12:14:40 +02:00
parent e3b11a9eb2
commit 8b085af6a1
2 changed files with 21 additions and 6 deletions

View File

@ -134,7 +134,7 @@ class AccountController extends Controller
$total = Auth::user()->accounts()->accountTypeIn($types)->count(); $total = Auth::user()->accounts()->accountTypeIn($types)->count();
// last activity: // last activity:
$start = clone Session::get('start'); $start = clone Session::get('start', Carbon::now()->startOfMonth());
$start->subDay(); $start->subDay();
$set->each( $set->each(
function (Account $account) use ($start) { function (Account $account) use ($start) {

View File

@ -1,4 +1,5 @@
<?php <?php
use Carbon\Carbon;
use FireflyIII\Models\Preference; use FireflyIII\Models\Preference;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use League\FactoryMuffin\Facade as FactoryMuffin; use League\FactoryMuffin\Facade as FactoryMuffin;
@ -121,7 +122,21 @@ class AccountControllerTest extends TestCase
public function testIndex() public function testIndex()
{ {
$this->markTestIncomplete(); $user = FactoryMuffin::create('FireflyIII\User');
$this->be($user);
// get currency code:
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
Amount::shouldReceive('getCurrencyCode')->andReturn($currency->code);
// put stuff in session:
$this->session(['start' => new Carbon, 'end' => new Carbon]);
// get edit page:
$this->call('GET', '/accounts/asset');
$this->assertResponseOk();
$this->assertViewHas('what', 'asset');
} }
public function testShow() public function testShow()