This commit is contained in:
James Cole
2015-05-16 08:14:26 +02:00
parent 3896a66122
commit 3270d3bf96
5 changed files with 0 additions and 225 deletions

View File

@@ -118,108 +118,4 @@ class ReportHelperTest extends TestCase
}
public function testYearBalanceReport()
{
$date = new Carbon('2015-01-01');
$user = FactoryMuffin::create('FireflyIII\User');
$setShared = [];
$setNormal = [];
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
$assetType = FactoryMuffin::create('FireflyIII\Models\AccountType');
// need some shared accounts:
for ($i = 0; $i < 3; $i++) {
$shared = FactoryMuffin::create('FireflyIII\Models\Account');
$shared->user_id = $user->id;
$shared->account_type_id = $assetType->id;
$shared->save();
// meta for shared:
AccountMeta::create(
[
'account_id' => $shared->id,
'name' => 'accountRole',
'data' => 'sharedAsset',
]
);
$setShared[] = $shared;
}
// need some normal accounts:
for ($i = 0; $i < 3; $i++) {
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$account->user_id = $user->id;
$account->account_type_id = $assetType->id;
$account->save();
$setNormal[] = $account;
}
// mock stuff:
Steam::shouldReceive('balance')->withAnyArgs()->andReturn(0);
$this->be($user);
$result = $this->object->yearBalanceReport($date, false);
foreach ($result as $entry) {
// everything is hidden:
$this->assertTrue($entry['hide']);
// nothing is shared:
$this->assertFalse($entry['shared']);
}
}
public function testYearBalanceReportWithShared()
{
$date = new Carbon('2015-01-01');
$user = FactoryMuffin::create('FireflyIII\User');
$setShared = [];
$setNormal = [];
FactoryMuffin::create('FireflyIII\Models\AccountType');
FactoryMuffin::create('FireflyIII\Models\AccountType');
$assetType = FactoryMuffin::create('FireflyIII\Models\AccountType');
// need some shared accounts:
for ($i = 0; $i < 3; $i++) {
$shared = FactoryMuffin::create('FireflyIII\Models\Account');
$shared->user_id = $user->id;
$shared->account_type_id = $assetType->id;
$shared->save();
// meta for shared:
AccountMeta::create(
[
'account_id' => $shared->id,
'name' => 'accountRole',
'data' => 'sharedAsset',
]
);
$setShared[] = $shared;
}
// need some normal accounts:
for ($i = 0; $i < 3; $i++) {
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$account->user_id = $user->id;
$account->account_type_id = $assetType->id;
$account->save();
$setNormal[] = $account;
}
// mock stuff:
Steam::shouldReceive('balance')->withAnyArgs()->andReturn(0);
$this->be($user);
$result = $this->object->yearBalanceReport($date, true);
foreach ($result as $entry) {
// everything is hidden:
$this->assertTrue($entry['hide']);
// nothing is shared:
$this->assertFalse($entry['shared']);
}
}
}