Improved coverage.

This commit is contained in:
James Cole
2015-05-22 15:05:32 +02:00
parent 623bb4b350
commit 1f865d3ea4
9 changed files with 57 additions and 401 deletions

View File

@@ -235,6 +235,20 @@ class ReportHelperTest extends TestCase
$right->account_type_id = $asset->id;
$right->save();
$left->save();
// save meta for account:
AccountMeta::create([
'account_id' => $left->id,
'name' => 'accountRole',
'data' => 'defaultAsset'
]);
AccountMeta::create([
'account_id' => $right->id,
'name' => 'accountRole',
'data' => 'defaultAsset'
]);
for ($i = 0; $i < 5; $i++) {
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
$journal->date = $date;
@@ -281,6 +295,19 @@ class ReportHelperTest extends TestCase
$asset = FactoryMuffin::create('FireflyIII\Models\AccountType');
$left->account_type_id = $asset->id;
$right->account_type_id = $asset->id;
// save meta for account:
AccountMeta::create([
'account_id' => $left->id,
'name' => 'accountRole',
'data' => 'defaultAsset'
]);
AccountMeta::create([
'account_id' => $right->id,
'name' => 'accountRole',
'data' => 'defaultAsset'
]);
$right->save();
$left->save();
for ($i = 0; $i < 5; $i++) {

View File

@@ -70,13 +70,13 @@ class BudgetRepositoryTest extends TestCase
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::expensesOnDay
* @covers FireflyIII\Repositories\Budget\BudgetRepository::expensesOnDayCorrected
*/
public function testExpensesOnDay()
public function testExpensesOnDayCorrected()
{
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$result = $this->object->expensesOnDay($budget, new Carbon);
$result = $this->object->expensesOnDayCorrected($budget, new Carbon);
$this->assertEquals(0, $result);
}
@@ -289,13 +289,13 @@ class BudgetRepositoryTest extends TestCase
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::spentInPeriod
* @covers FireflyIII\Repositories\Budget\BudgetRepository::spentInPeriodCorrected
*/
public function testSpentInPeriod()
public function testSpentInPeriodCorrected()
{
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$amount = $this->object->spentInPeriod($budget, new Carbon, new Carbon);
$amount = $this->object->spentInPeriodCorrected($budget, new Carbon, new Carbon);
$this->assertEquals(0, $amount);
}
@@ -316,16 +316,6 @@ class BudgetRepositoryTest extends TestCase
$this->assertEquals($result->name, $data['name']);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::sumBudgetExpensesInPeriod
*/
public function testSumBudgetExpensesInPeriod()
{
$budget = FactoryMuffin::create('FireflyIII\Models\Budget');
$result = $this->object->sumBudgetExpensesInPeriod($budget, new Carbon, new Carbon);
$this->assertEquals(0, $result);
}
/**
* @covers FireflyIII\Repositories\Budget\BudgetRepository::update
*/

View File

@@ -79,9 +79,9 @@ class CategoryRepositoryTest extends TestCase
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::getCategoriesAndExpenses
* @covers FireflyIII\Repositories\Category\CategoryRepository::getCategoriesAndExpensesCorrected
*/
public function testGetCategoriesAndExpenses()
public function testGetCategoriesAndExpensesCorrected()
{
$user = FactoryMuffin::create('FireflyIII\User');
$type = FactoryMuffin::create('FireflyIII\Models\TransactionType');
@@ -100,9 +100,11 @@ class CategoryRepositoryTest extends TestCase
}
$this->be($user);
$set = $this->object->getCategoriesAndExpenses(new Carbon('2015-02-01'), new Carbon('2015-02-28'));
$set = $this->object->getCategoriesAndExpensesCorrected(new Carbon('2015-02-01'), new Carbon('2015-02-28'));
$this->assertCount(5, $set);
$this->assertEquals(0, $set->first()->sum);
reset($set);
$this->assertEquals(0, current($set)['sum']);
}
/**
@@ -189,12 +191,12 @@ class CategoryRepositoryTest extends TestCase
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::spentInPeriod
* @covers FireflyIII\Repositories\Category\CategoryRepository::spentInPeriodCorrected
*/
public function testSpentInPeriodSum()
public function testSpentInPeriodSumCorrected()
{
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$sum = $this->object->spentInPeriod($category, new Carbon, new Carbon);
$sum = $this->object->spentInPeriodCorrected($category, new Carbon, new Carbon);
$this->assertEquals(0, $sum);
@@ -202,12 +204,12 @@ class CategoryRepositoryTest extends TestCase
}
/**
* @covers FireflyIII\Repositories\Category\CategoryRepository::spentOnDaySum
* @covers FireflyIII\Repositories\Category\CategoryRepository::spentOnDaySumCorrected
*/
public function testSpentOnDaySum()
public function testSpentOnDaySumCorrected()
{
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$sum = $this->object->spentOnDaySum($category, new Carbon);
$sum = $this->object->spentOnDaySumCorrected($category, new Carbon);
$this->assertEquals(0, $sum);
}