account_type_id = $asset->id; $two->account_type_id = $asset->id; $one->save(); $two->save(); $accounts = new Collection([$one, $two]); $date = new Carbon; $this->be($user); // make one shared: AccountMeta::create( [ 'account_id' => $one->id, 'name' => 'accountRole', 'data' => 'sharedAsset' ] ); // mock! $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface'); // fake! $repository->shouldReceive('getAccounts')->once()->andReturn($accounts); $this->call('GET', '/chart/account/month/' . $date->format('Y/m')); $this->assertResponseOk(); } /** * @covers FireflyIII\Http\Controllers\Chart\AccountController::all */ public function testAllShared() { $user = FactoryMuffin::create('FireflyIII\User'); $account = FactoryMuffin::create('FireflyIII\Models\Account'); $accounts = new Collection([$account]); $date = new Carbon; $this->be($user); // make it shared: AccountMeta::create( [ 'account_id' => $account->id, 'name' => 'accountRole', 'data' => 'sharedAsset' ] ); // mock! $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface'); // fake! $repository->shouldReceive('getAccounts')->once()->andReturn($accounts); $this->call('GET', '/chart/account/month/' . $date->format('Y/m') . '/shared'); $this->assertResponseOk(); } /** * @covers FireflyIII\Http\Controllers\Chart\AccountController::frontpage */ public function testFrontpage() { $accounts = new Collection([FactoryMuffin::create('FireflyIII\Models\Account')]); $user = FactoryMuffin::create('FireflyIII\User'); $this->be($user); // mock! $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface'); // fake! $repository->shouldReceive('getFrontpageAccounts')->andReturn($accounts); $this->call('GET', '/chart/account/frontpage'); $this->assertResponseOk(); } /** * @covers FireflyIII\Http\Controllers\Chart\AccountController::single */ public function testSingle() { $account = FactoryMuffin::create('FireflyIII\Models\Account'); $this->be($account->user); $this->call('GET', '/chart/account/' . $account->id); $this->assertResponseOk(); } }