mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Working test code.
This commit is contained in:
parent
e766614630
commit
9f19d26a23
@ -94,6 +94,9 @@ class AccountControllerTest extends TestCase
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('1');
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('BIC');
|
||||
$repository->shouldReceive('getNoteText')->withArgs([Mockery::any()])->andReturn('Hello');
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('2')->atLeast()->once();
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('daily')->atLeast()->once();
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn(true)->atLeast()->once();
|
||||
|
||||
// test API
|
||||
$response = $this->get('/api/v1/accounts');
|
||||
@ -254,6 +257,9 @@ class AccountControllerTest extends TestCase
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('1');
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('BIC');
|
||||
$repository->shouldReceive('getNoteText')->withArgs([Mockery::any()])->andReturn('Hello');
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('2')->atLeast()->once();
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('daily')->atLeast()->once();
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn(true)->atLeast()->once();
|
||||
|
||||
|
||||
// test API
|
||||
@ -288,6 +294,9 @@ class AccountControllerTest extends TestCase
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('1');
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('BIC');
|
||||
$repository->shouldReceive('getNoteText')->withArgs([Mockery::any()])->andReturn('Hello');
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('2')->atLeast()->once();
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('daily')->atLeast()->once();
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn(true)->atLeast()->once();
|
||||
|
||||
// data to submit
|
||||
$data = [
|
||||
@ -377,6 +386,9 @@ class AccountControllerTest extends TestCase
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('1');
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('BIC');
|
||||
$repository->shouldReceive('getNoteText')->withArgs([Mockery::any()])->andReturn('Hello');
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('2')->atLeast()->once();
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('daily')->atLeast()->once();
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn(true)->atLeast()->once();
|
||||
|
||||
// data to submit
|
||||
$data = [
|
||||
@ -422,6 +434,9 @@ class AccountControllerTest extends TestCase
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('1');
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('BIC');
|
||||
$repository->shouldReceive('getNoteText')->withArgs([Mockery::any()])->andReturn('Hello');
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('2')->atLeast()->once();
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('daily')->atLeast()->once();
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn(true)->atLeast()->once();
|
||||
|
||||
// functions to expect:
|
||||
|
||||
@ -467,6 +482,9 @@ class AccountControllerTest extends TestCase
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('1');
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('BIC');
|
||||
$repository->shouldReceive('getNoteText')->withArgs([Mockery::any()])->andReturn('Hello');
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('2')->atLeast()->once();
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('daily')->atLeast()->once();
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn(true)->atLeast()->once();
|
||||
|
||||
$account = $this->user()->accounts()->first();
|
||||
// data to submit
|
||||
@ -512,6 +530,9 @@ class AccountControllerTest extends TestCase
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('1');
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('BIC');
|
||||
$repository->shouldReceive('getNoteText')->withArgs([Mockery::any()])->andReturn('Hello');
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('2')->atLeast()->once();
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('daily')->atLeast()->once();
|
||||
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn(true)->atLeast()->once();
|
||||
|
||||
$account = $this->user()->accounts()->first();
|
||||
// data to submit
|
||||
|
@ -27,6 +27,7 @@ use Carbon\Carbon;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
use FireflyIII\Models\PiggyBankRepetition;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
@ -120,12 +121,13 @@ class PiggyBankControllerTest extends TestCase
|
||||
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
|
||||
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
||||
|
||||
// new account list thing.
|
||||
$currency = TransactionCurrency::first();
|
||||
$account = factory(Account::class)->make();
|
||||
$currency = TransactionCurrency::first();
|
||||
$account = factory(Account::class)->make();
|
||||
$currencyRepos->shouldReceive('findNull')->andReturn($currency);
|
||||
|
||||
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
|
||||
@ -149,10 +151,12 @@ class PiggyBankControllerTest extends TestCase
|
||||
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
|
||||
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('piggy-banks.delete', [1]));
|
||||
$response->assertStatus(200);
|
||||
@ -192,6 +196,7 @@ class PiggyBankControllerTest extends TestCase
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
|
||||
|
||||
// mock stuff
|
||||
$account = factory(Account::class)->make();
|
||||
@ -239,11 +244,16 @@ class PiggyBankControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('1234')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('1234')->atLeast()->once();
|
||||
|
||||
$currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::find(1))->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('2')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('daily')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn(true)->atLeast()->once();
|
||||
|
||||
$accountRepos->shouldReceive('getOpeningBalanceAmount')->withAnyArgs()->andReturn('10')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getOpeningBalanceDate')->withAnyArgs()->andReturn(new Carbon())->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getNoteText')->withAnyArgs()->andReturn('Hello')->atLeast()->once();
|
||||
|
||||
$currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::find(1))->atLeast()->once();
|
||||
|
||||
|
||||
$first = $this->user()->transactionJournals()->inRandomOrder()->first();
|
||||
$piggies = $this->user()->piggyBanks()->take(2)->get();
|
||||
@ -381,10 +391,12 @@ class PiggyBankControllerTest extends TestCase
|
||||
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
|
||||
$repetition = PiggyBankRepetition::first();
|
||||
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1')->atLeast()->once();
|
||||
$currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::find(1))->atLeast()->once();
|
||||
|
||||
$piggyRepos->shouldReceive('getRepetition')->once()->andReturn($repetition);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
@ -402,11 +414,14 @@ class PiggyBankControllerTest extends TestCase
|
||||
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
|
||||
$repetition = PiggyBankRepetition::first();
|
||||
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1')->atLeast()->once();
|
||||
$currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::find(1))->atLeast()->once();
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$piggyRepos->shouldReceive('getRepetition')->once()->andReturn($repetition);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('piggy-banks.remove-money-mobile', [1]));
|
||||
|
@ -22,12 +22,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Generator\Report\Account\YearReportGenerator as AcYRG;
|
||||
use FireflyIII\Generator\Report\Audit\YearReportGenerator as AYRG;
|
||||
use FireflyIII\Generator\Report\Budget\YearReportGenerator as BYRG;
|
||||
use FireflyIII\Generator\Report\Category\YearReportGenerator as CYRG;
|
||||
use FireflyIII\Generator\Report\Standard\YearReportGenerator as SYRG;
|
||||
use FireflyIII\Generator\Report\Tag\YearReportGenerator as TYRG;
|
||||
use FireflyIII\Helpers\FiscalHelperInterface;
|
||||
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
@ -72,12 +74,18 @@ class ReportControllerTest extends TestCase
|
||||
{
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$budgetRepository->shouldReceive('cleanupBudgets');
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$generator = $this->mock(AcYRG::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
$generator = $this->mock(AcYRG::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$budgetRepository->shouldReceive('cleanupBudgets');
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$start = Carbon::create()->startOfYear();
|
||||
$end = Carbon::create()->endOfYear();
|
||||
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);
|
||||
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);
|
||||
|
||||
$generator->shouldReceive('setStartDate')->once();
|
||||
$generator->shouldReceive('setEndDate')->once();
|
||||
@ -97,12 +105,21 @@ class ReportControllerTest extends TestCase
|
||||
{
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$generator = $this->mock(AYRG::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
$budgetRepository->shouldReceive('cleanupBudgets');
|
||||
|
||||
$generator = $this->mock(AYRG::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$start = Carbon::create()->startOfYear();
|
||||
$end = Carbon::create()->endOfYear();
|
||||
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);
|
||||
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);
|
||||
|
||||
$generator->shouldReceive('setStartDate')->once();
|
||||
$generator->shouldReceive('setEndDate')->once();
|
||||
$generator->shouldReceive('setAccounts')->once();
|
||||
@ -120,10 +137,17 @@ class ReportControllerTest extends TestCase
|
||||
{
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$budgetRepository->shouldReceive('cleanupBudgets');
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$generator = $this->mock(BYRG::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
$start = Carbon::create()->startOfYear();
|
||||
$end = Carbon::create()->endOfYear();
|
||||
|
||||
$generator = $this->mock(BYRG::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);
|
||||
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);
|
||||
|
||||
$budgetRepository->shouldReceive('cleanupBudgets');
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$generator->shouldReceive('setStartDate')->once();
|
||||
$generator->shouldReceive('setEndDate')->once();
|
||||
@ -143,11 +167,19 @@ class ReportControllerTest extends TestCase
|
||||
{
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$generator = $this->mock(CYRG::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
$start = Carbon::create()->startOfYear();
|
||||
$end = Carbon::create()->endOfYear();
|
||||
|
||||
$budgetRepository->shouldReceive('cleanupBudgets');
|
||||
|
||||
$generator = $this->mock(CYRG::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);
|
||||
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);
|
||||
|
||||
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$generator->shouldReceive('setStartDate')->once();
|
||||
$generator->shouldReceive('setEndDate')->once();
|
||||
@ -167,11 +199,17 @@ class ReportControllerTest extends TestCase
|
||||
{
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$generator = $this->mock(SYRG::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
$start = Carbon::create()->startOfYear();
|
||||
$end = Carbon::create()->endOfYear();
|
||||
|
||||
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);
|
||||
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);
|
||||
|
||||
$budgetRepository->shouldReceive('cleanupBudgets');
|
||||
|
||||
$generator = $this->mock(SYRG::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$generator->shouldReceive('setStartDate')->once();
|
||||
$generator->shouldReceive('setEndDate')->once();
|
||||
@ -190,10 +228,15 @@ class ReportControllerTest extends TestCase
|
||||
{
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
$start = Carbon::create()->startOfYear();
|
||||
$end = Carbon::create()->endOfYear();
|
||||
|
||||
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);
|
||||
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);
|
||||
$budgetRepository->shouldReceive('cleanupBudgets');
|
||||
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
@ -209,13 +252,13 @@ class ReportControllerTest extends TestCase
|
||||
{
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$helper = $this->mock(ReportHelperInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
|
||||
$budgetRepository->shouldReceive('cleanupBudgets');
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
||||
|
||||
$helper = $this->mock(ReportHelperInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$helper->shouldReceive('listOfMonths')->andReturn([]);
|
||||
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection)->once();
|
||||
@ -233,9 +276,10 @@ class ReportControllerTest extends TestCase
|
||||
{
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
@ -250,16 +294,17 @@ class ReportControllerTest extends TestCase
|
||||
{
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(AccountRepositoryInterface::class);
|
||||
|
||||
$account = new Account();
|
||||
$account->name = 'Something';
|
||||
$account->id = 3;
|
||||
$collection = new Collection([$account]);
|
||||
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$repository = $this->mock(AccountRepositoryInterface::class);
|
||||
$repository->shouldReceive('getActiveAccountsByType')->withArgs([[AccountType::EXPENSE]])->once()->andReturn($collection);
|
||||
$repository->shouldReceive('getActiveAccountsByType')->withArgs([[AccountType::REVENUE]])->once()->andReturn($collection);
|
||||
|
||||
@ -275,12 +320,14 @@ class ReportControllerTest extends TestCase
|
||||
{
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
|
||||
$budget = factory(Budget::class)->make();
|
||||
|
||||
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$budgetRepos = $this->mock(BudgetRepositoryInterface::class);
|
||||
$budget = factory(Budget::class)->make();
|
||||
|
||||
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection([$budget]));
|
||||
|
||||
$this->be($this->user());
|
||||
@ -296,12 +343,13 @@ class ReportControllerTest extends TestCase
|
||||
{
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
$category = factory(Category::class)->make();
|
||||
|
||||
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$category = factory(Category::class)->make();
|
||||
$categoryRepos->shouldReceive('getCategories')->andReturn(new Collection([$category]));
|
||||
|
||||
$this->be($this->user());
|
||||
@ -316,12 +364,15 @@ class ReportControllerTest extends TestCase
|
||||
{
|
||||
$budgetRepository = $this->mock(BudgetRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$tag = factory(Tag::class)->make();
|
||||
|
||||
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$tag = factory(Tag::class)->make();
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
|
||||
|
||||
$tagRepos->shouldReceive('get')->andReturn(new Collection([$tag]));
|
||||
|
||||
$this->be($this->user());
|
||||
@ -341,8 +392,10 @@ class ReportControllerTest extends TestCase
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->times(3);
|
||||
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->times(4);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$data = [
|
||||
@ -370,6 +423,8 @@ class ReportControllerTest extends TestCase
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
|
||||
@ -398,6 +453,8 @@ class ReportControllerTest extends TestCase
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
@ -429,6 +486,8 @@ class ReportControllerTest extends TestCase
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
|
||||
@ -459,7 +518,8 @@ class ReportControllerTest extends TestCase
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
|
||||
@ -490,6 +550,8 @@ class ReportControllerTest extends TestCase
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$categoryRepos->shouldReceive('findNull')->andReturn($this->user()->categories()->find(1))->twice();
|
||||
@ -520,6 +582,8 @@ class ReportControllerTest extends TestCase
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
|
||||
@ -548,6 +612,8 @@ class ReportControllerTest extends TestCase
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
|
||||
@ -576,6 +642,8 @@ class ReportControllerTest extends TestCase
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
|
||||
@ -607,6 +675,8 @@ class ReportControllerTest extends TestCase
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
/** @var Tag $tag */
|
||||
$tag = $this->user()->tags()->find(1);
|
||||
@ -644,6 +714,8 @@ class ReportControllerTest extends TestCase
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
/** @var Tag $tag */
|
||||
$tag = $this->user()->tags()->find(1);
|
||||
@ -680,6 +752,8 @@ class ReportControllerTest extends TestCase
|
||||
$categoryRepos = $this->mock(CategoryRepositoryInterface::class);
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
@ -708,9 +782,14 @@ class ReportControllerTest extends TestCase
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$generator = $this->mock(TYRG::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
|
||||
$reportHelper = $this->mock(ReportHelperInterface::class);
|
||||
$tag = $this->user()->tags()->find(1);
|
||||
$start = Carbon::create()->startOfYear();
|
||||
$end = Carbon::create()->endOfYear();
|
||||
|
||||
$tag = $this->user()->tags()->find(1);
|
||||
|
||||
$fiscalHelper->shouldReceive('startOfFiscalYear')->atLeast()->once()->andReturn($start);
|
||||
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($end);
|
||||
$tagRepos->shouldReceive('setUser');
|
||||
$tagRepos->shouldReceive('get')->andReturn(new Collection([$tag]));
|
||||
|
||||
|
@ -154,6 +154,9 @@ class AccountTransformerTest extends TestCase
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'ccType'])->andReturn('monthlyFull');
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'accountNumber'])->andReturn('123');
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'BIC'])->andReturn('123');
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest'])->andReturn('2')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'interest_period'])->andReturn('daily')->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'include_net_worth'])->andReturn(true)->atLeast()->once();
|
||||
$accountRepos->shouldReceive('getNoteText')->andReturn($note->text);
|
||||
$accountRepos->shouldReceive('getOpeningBalanceAmount')->andReturn(null);
|
||||
$accountRepos->shouldReceive('getOpeningBalanceDate')->andReturn(null);
|
||||
|
Loading…
Reference in New Issue
Block a user