Fix some tests.

This commit is contained in:
James Cole
2019-08-17 11:32:05 +02:00
parent 6d1bfd3956
commit 1d4434698e
4 changed files with 33 additions and 46 deletions

View File

@@ -98,10 +98,10 @@ class CategoryControllerTest extends TestCase
$this->mockDefaultSession();
Preferences::shouldReceive('lastActivity')->atLeast()->once()->andReturn('md512345');
$repository->shouldReceive('spentInPeriod')->andReturn('0')->atLeast()->once();
$repository->shouldReceive('earnedInPeriod')->andReturn('0')->atLeast()->once();
$repository->shouldReceive('spentInPeriod')->andReturn([])->atLeast()->once();
$repository->shouldReceive('earnedInPeriod')->andReturn([])->atLeast()->once();
$repository->shouldReceive('firstUseDate')->andReturn($firstUseDate)->once();
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection)->once();
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT,AccountType::MORTGAGE]])->andReturn(new Collection)->once();
$generator->shouldReceive('multiSet')->once()->andReturn([]);
$this->be($this->user());
@@ -245,8 +245,8 @@ class CategoryControllerTest extends TestCase
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($date);
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection([$account]));
$repository->shouldReceive('spentInPeriod')->andReturn('0');
$repository->shouldReceive('earnedInPeriod')->andReturn('0');
$repository->shouldReceive('spentInPeriod')->andReturn([]);
$repository->shouldReceive('earnedInPeriod')->andReturn([]);
$generator->shouldReceive('multiSet')->andReturn([])->once();
$this->be($this->user());

View File

@@ -26,7 +26,6 @@ use Carbon\Carbon;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Fiscal\FiscalHelperInterface;
use FireflyIII\Helpers\Report\NetWorthInterface;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Account\AccountTaskerInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
@@ -116,8 +115,12 @@ class ReportControllerTest extends TestCase
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($date);
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($date);
$income = [1 => ['sum' => '100']];
$expense = [2 => ['sum' => '-100']];
$income = [
'accounts' => [
1 => ['sum' => '100']]];
$expense = [
'accounts' => [
2 => ['sum' => '-100']]];
$tasker->shouldReceive('getIncomeReport')->once()->andReturn($income);
$tasker->shouldReceive('getExpenseReport')->once()->andReturn($expense);
$generator->shouldReceive('multiSet')->andReturn([]);
@@ -144,8 +147,12 @@ class ReportControllerTest extends TestCase
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($date);
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($date);
$income = [];
$expense = [];
$income = [
'accounts' => [
1 => ['sum' => '100']]];
$expense = [
'accounts' => [
2 => ['sum' => '-100']]];
$tasker->shouldReceive('getIncomeReport')->andReturn($income)->times(1);
$tasker->shouldReceive('getExpenseReport')->andReturn($expense)->times(1);