Improve code quality and fix test coverage.

This commit is contained in:
James Cole
2018-04-28 10:27:33 +02:00
parent 7b39828980
commit e126427809
75 changed files with 430 additions and 369 deletions

View File

@@ -649,9 +649,10 @@ class BudgetController extends Controller
*/ */
private function getPeriodOverview(): Collection private function getPeriodOverview(): Collection
{ {
/** @var JournalRepositoryInterface $repository */
$repository = app(JournalRepositoryInterface::class); $repository = app(JournalRepositoryInterface::class);
$first = $repository->first(); $first = $repository->firstNull();
$start = $first->date ?? new Carbon; $start = null === $first ? new Carbon : $first->date;
$range = Preferences::get('viewRange', '1M')->data; $range = Preferences::get('viewRange', '1M')->data;
$start = app('navigation')->startOfPeriod($start, $range); $start = app('navigation')->startOfPeriod($start, $range);
$end = app('navigation')->endOfX(new Carbon, $range, null); $end = app('navigation')->endOfX(new Carbon, $range, null);

View File

@@ -128,8 +128,8 @@ class TransactionController extends Controller
$page = (int)$request->get('page'); $page = (int)$request->get('page');
$pageSize = (int)Preferences::get('listPageSize', 50)->data; $pageSize = (int)Preferences::get('listPageSize', 50)->data;
$path = route('transactions.index.all', [$what]); $path = route('transactions.index.all', [$what]);
$first = $this->repository->first(); $first = $this->repository->firstNull();
$start = $first->date ?? new Carbon; $start = null === $first ? new Carbon : $first->date;
$end = new Carbon; $end = new Carbon;
$subTitle = trans('firefly.all_' . $what); $subTitle = trans('firefly.all_' . $what);

View File

@@ -140,7 +140,7 @@ class Range
$first = Carbon::now()->startOfYear(); $first = Carbon::now()->startOfYear();
if (null !== $journal) { if (null !== $journal) {
$first = $journal->date; $first = $journal->date ?? $first;
} }
Session::put('first', $first); Session::put('first', $first);
} }

View File

@@ -80,7 +80,7 @@ class Sandstorm
return $next($request); return $next($request);
} }
if (1 === $count && 0 === \strlen($userId)) { if (1 === $count && '' === $userId) {
// login but indicate anonymous // login but indicate anonymous
$user = User::first(); $user = User::first();
Auth::guard($guard)->login($user); Auth::guard($guard)->login($user);
@@ -111,7 +111,7 @@ class Sandstorm
return $next($request); return $next($request);
} }
if (0 === $count && 0 === \strlen($userId)) { if (0 === $count && '' === $userId) {
throw new FireflyException('The first visit to a new Firefly III administration cannot be by a guest user.'); throw new FireflyException('The first visit to a new Firefly III administration cannot be by a guest user.');
} }
@@ -121,7 +121,7 @@ class Sandstorm
} }
// if in Sandstorm, user logged in, still must check if user is anon. // if in Sandstorm, user logged in, still must check if user is anon.
$userId = (string)$request->header('X-Sandstorm-User-Id'); $userId = (string)$request->header('X-Sandstorm-User-Id');
if (\strlen($userId) === 0) { if ('' === $userId) {
View::share('SANDSTORM_ANON', true); View::share('SANDSTORM_ANON', true);
return $next($request); return $next($request);

View File

@@ -17,7 +17,8 @@
<table class="table table-striped sortable"> <table class="table table-striped sortable">
<thead> <thead>
<tr> <tr>
<th data-defaultsign="_19" colspan="2">{{ trans('list.file_name') }}</th> <th data-defaultsign="_19">&nbsp;</th>
<th data-defaultsign="az">{{ trans('list.file_name') }}</th>
<th data-defaultsign="_19">{{ trans('list.file_size') }}</th> <th data-defaultsign="_19">{{ trans('list.file_size') }}</th>
<th data-defaultsign="az">{{ trans('list.file_type') }}</th> <th data-defaultsign="az">{{ trans('list.file_type') }}</th>
<th data-defaultsign="az">{{ trans('list.attached_to') }}</th> <th data-defaultsign="az">{{ trans('list.attached_to') }}</th>

View File

@@ -39,7 +39,7 @@ class AboutControllerTest extends TestCase
{ {
parent::setUp(); parent::setUp();
Passport::actingAs($this->user()); Passport::actingAs($this->user());
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -44,7 +44,7 @@ class AccountControllerTest extends TestCase
{ {
parent::setUp(); parent::setUp();
Passport::actingAs($this->user()); Passport::actingAs($this->user());
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -43,7 +43,7 @@ class BillControllerTest extends TestCase
{ {
parent::setUp(); parent::setUp();
Passport::actingAs($this->user()); Passport::actingAs($this->user());
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }

View File

@@ -46,7 +46,7 @@ class CurrencyControllerTest extends TestCase
{ {
parent::setUp(); parent::setUp();
Passport::actingAs($this->user()); Passport::actingAs($this->user());
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }

View File

@@ -48,7 +48,7 @@ class TransactionControllerTest extends TestCase
{ {
parent::setUp(); parent::setUp();
Passport::actingAs($this->user()); Passport::actingAs($this->user());
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -43,7 +43,7 @@ class UserControllerTest extends TestCase
{ {
parent::setUp(); parent::setUp();
Passport::actingAs($this->user()); Passport::actingAs($this->user());
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }

View File

@@ -50,7 +50,7 @@ class ReconcileControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**
@@ -61,7 +61,7 @@ class ReconcileControllerTest extends TestCase
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$journal = $this->user()->transactionJournals()->where('transaction_type_id', 5)->first(); $journal = $this->user()->transactionJournals()->where('transaction_type_id', 5)->first();
$transaction = $journal->transactions()->where('amount', '>', 0)->first(); $transaction = $journal->transactions()->where('amount', '>', 0)->first();
$repository->shouldReceive('first')->andReturn($journal); $repository->shouldReceive('firstNull')->andReturn($journal);
$repository->shouldReceive('getFirstPosTransaction')->andReturn($transaction); $repository->shouldReceive('getFirstPosTransaction')->andReturn($transaction);
$repository->shouldReceive('getJournalDate')->andReturn('2018-01-01'); $repository->shouldReceive('getJournalDate')->andReturn('2018-01-01');
$repository->shouldReceive('getJournalCategoryName')->andReturn(''); $repository->shouldReceive('getJournalCategoryName')->andReturn('');
@@ -94,7 +94,7 @@ class ReconcileControllerTest extends TestCase
{ {
$transactions = $this->user()->transactions()->inRandomOrder()->take(3)->get(); $transactions = $this->user()->transactions()->inRandomOrder()->take(3)->get();
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('first')->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$repository->shouldReceive('getTransactionsById')->andReturn($transactions)->twice(); $repository->shouldReceive('getTransactionsById')->andReturn($transactions)->twice();
$parameters = [ $parameters = [
@@ -213,7 +213,7 @@ class ReconcileControllerTest extends TestCase
{ {
$journal = $this->user()->transactionJournals()->where('transaction_type_id', 5)->first(); $journal = $this->user()->transactionJournals()->where('transaction_type_id', 5)->first();
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('first')->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$repository->shouldReceive('getAssetTransaction')->once()->andReturn($journal->transactions()->first()); $repository->shouldReceive('getAssetTransaction')->once()->andReturn($journal->transactions()->first());
$this->be($this->user()); $this->be($this->user());
@@ -244,7 +244,7 @@ class ReconcileControllerTest extends TestCase
{ {
$repository = $this->mock(AccountRepositoryInterface::class); $repository = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('reconcileById')->andReturn(true); $journalRepos->shouldReceive('reconcileById')->andReturn(true);
$journalRepos->shouldReceive('store')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('store')->andReturn(new TransactionJournal);
$repository->shouldReceive('getReconciliation')->andReturn(new Account); $repository->shouldReceive('getReconciliation')->andReturn(new Account);
@@ -297,7 +297,7 @@ class ReconcileControllerTest extends TestCase
public function testUpdate() public function testUpdate()
{ {
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([new Account])); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([new Account]));
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([new Account])); $journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([new Account]));
$journalRepos->shouldReceive('getNoteText')->andReturn(''); $journalRepos->shouldReceive('getNoteText')->andReturn('');

View File

@@ -57,7 +57,7 @@ class AccountControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -71,7 +71,7 @@ class AccountControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$repository = $this->mock(CurrencyRepositoryInterface::class); $repository = $this->mock(CurrencyRepositoryInterface::class);
$repository->shouldReceive('get')->andReturn(new Collection); $repository->shouldReceive('get')->andReturn(new Collection);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('accounts.create', ['asset'])); $response = $this->get(route('accounts.create', ['asset']));
@@ -91,7 +91,7 @@ class AccountControllerTest extends TestCase
$repository = $this->mock(AccountRepositoryInterface::class); $repository = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$repository->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET]])->andReturn(new Collection); $repository->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET]])->andReturn(new Collection);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first();
@@ -114,7 +114,7 @@ class AccountControllerTest extends TestCase
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$repository->shouldReceive('findNull')->withArgs([0])->once()->andReturn(null); $repository->shouldReceive('findNull')->withArgs([0])->once()->andReturn(null);
$repository->shouldReceive('destroy')->andReturn(true); $repository->shouldReceive('destroy')->andReturn(true);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->session(['accounts.delete.uri' => 'http://localhost/accounts/show/1']); $this->session(['accounts.delete.uri' => 'http://localhost/accounts/show/1']);
$account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first(); $account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first();
@@ -139,7 +139,7 @@ class AccountControllerTest extends TestCase
$repository->shouldReceive('findNull')->once()->andReturn(TransactionCurrency::find(1)); $repository->shouldReceive('findNull')->once()->andReturn(TransactionCurrency::find(1));
$repository->shouldReceive('get')->andReturn(new Collection); $repository->shouldReceive('get')->andReturn(new Collection);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('getNote')->andReturn($note)->once(); $accountRepos->shouldReceive('getNote')->andReturn($note)->once();
$accountRepos->shouldReceive('getOpeningBalanceAmount')->andReturnNull(); $accountRepos->shouldReceive('getOpeningBalanceAmount')->andReturnNull();
$accountRepos->shouldReceive('getOpeningBalanceDate')->andReturnNull(); $accountRepos->shouldReceive('getOpeningBalanceDate')->andReturnNull();
@@ -177,7 +177,7 @@ class AccountControllerTest extends TestCase
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$repository->shouldReceive('getAccountsByType')->andReturn(new Collection([$account])); $repository->shouldReceive('getAccountsByType')->andReturn(new Collection([$account]));
$repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1'); $repository->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::find(1)); $currencyRepos->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::find(1));
Steam::shouldReceive('balancesByAccounts')->andReturn([$account->id => '100']); Steam::shouldReceive('balancesByAccounts')->andReturn([$account->id => '100']);
Steam::shouldReceive('getLastActivities')->andReturn([]); Steam::shouldReceive('getLastActivities')->andReturn([]);
@@ -211,7 +211,7 @@ class AccountControllerTest extends TestCase
$currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1)); $currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1'); $tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1');
$tasker->shouldReceive('amountInInPeriod')->withAnyArgs()->andReturn('1'); $tasker->shouldReceive('amountInInPeriod')->withAnyArgs()->andReturn('1');
@@ -247,7 +247,7 @@ class AccountControllerTest extends TestCase
{ {
// mock // mock
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$this->session(['start' => '2018-01-01', 'end' => '2017-12-01']); $this->session(['start' => '2018-01-01', 'end' => '2017-12-01']);
@@ -267,7 +267,7 @@ class AccountControllerTest extends TestCase
// mock // mock
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$date = new Carbon; $date = new Carbon;
$this->session(['start' => $date, 'end' => clone $date]); $this->session(['start' => $date, 'end' => clone $date]);
@@ -289,7 +289,7 @@ class AccountControllerTest extends TestCase
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$collector->shouldReceive('setAccounts')->andReturnSelf(); $collector->shouldReceive('setAccounts')->andReturnSelf();
$collector->shouldReceive('setRange')->andReturnSelf(); $collector->shouldReceive('setRange')->andReturnSelf();
$collector->shouldReceive('setLimit')->andReturnSelf(); $collector->shouldReceive('setLimit')->andReturnSelf();
@@ -324,7 +324,7 @@ class AccountControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$date = new Carbon; $date = new Carbon;
$this->session(['start' => $date, 'end' => clone $date]); $this->session(['start' => $date, 'end' => clone $date]);
@@ -346,7 +346,7 @@ class AccountControllerTest extends TestCase
$repository = $this->mock(AccountRepositoryInterface::class); $repository = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$repository->shouldReceive('store')->once()->andReturn(factory(Account::class)->make()); $repository->shouldReceive('store')->once()->andReturn(factory(Account::class)->make());
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
// change the preference: // change the preference:
Preferences::setForUser($this->user(), 'frontPageAccounts', [1]); Preferences::setForUser($this->user(), 'frontPageAccounts', [1]);
@@ -375,7 +375,7 @@ class AccountControllerTest extends TestCase
$repository = $this->mock(AccountRepositoryInterface::class); $repository = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$repository->shouldReceive('store')->once()->andReturn(factory(Account::class)->make()); $repository->shouldReceive('store')->once()->andReturn(factory(Account::class)->make());
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->session(['accounts.create.uri' => 'http://localhost']); $this->session(['accounts.create.uri' => 'http://localhost']);
$this->be($this->user()); $this->be($this->user());
@@ -402,7 +402,7 @@ class AccountControllerTest extends TestCase
$repository = $this->mock(AccountRepositoryInterface::class); $repository = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$repository->shouldReceive('update')->once(); $repository->shouldReceive('update')->once();
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->session(['accounts.edit.uri' => 'http://localhost/javascript/account']); $this->session(['accounts.edit.uri' => 'http://localhost/javascript/account']);
$this->be($this->user()); $this->be($this->user());
@@ -429,7 +429,7 @@ class AccountControllerTest extends TestCase
$repository = $this->mock(AccountRepositoryInterface::class); $repository = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$repository->shouldReceive('update')->once(); $repository->shouldReceive('update')->once();
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->session(['accounts.edit.uri' => 'http://localhost']); $this->session(['accounts.edit.uri' => 'http://localhost']);
$this->be($this->user()); $this->be($this->user());

View File

@@ -42,7 +42,7 @@ class ConfigurationControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -42,7 +42,7 @@ class HomeControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -43,7 +43,7 @@ class LinkControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -47,7 +47,7 @@ class UpdateControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -42,7 +42,7 @@ class UserControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -43,7 +43,7 @@ class AttachmentControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -55,7 +55,7 @@ class AttachmentControllerTest extends TestCase
// mock stuff // mock stuff
$attachRepository = $this->mock(AttachmentRepositoryInterface::class); $attachRepository = $this->mock(AttachmentRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('attachments.delete', [1])); $response = $this->get(route('attachments.delete', [1]));
$response->assertStatus(200); $response->assertStatus(200);
@@ -72,7 +72,7 @@ class AttachmentControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(AttachmentRepositoryInterface::class); $repository = $this->mock(AttachmentRepositoryInterface::class);
$repository->shouldReceive('destroy')->andReturn(true); $repository->shouldReceive('destroy')->andReturn(true);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->session(['attachments.delete.uri' => 'http://localhost']); $this->session(['attachments.delete.uri' => 'http://localhost']);
$this->be($this->user()); $this->be($this->user());
@@ -91,7 +91,7 @@ class AttachmentControllerTest extends TestCase
$repository = $this->mock(AttachmentRepositoryInterface::class); $repository = $this->mock(AttachmentRepositoryInterface::class);
$repository->shouldReceive('exists')->once()->andReturn(true); $repository->shouldReceive('exists')->once()->andReturn(true);
$repository->shouldReceive('getContent')->once()->andReturn('This is attachment number one.'); $repository->shouldReceive('getContent')->once()->andReturn('This is attachment number one.');
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('attachments.download', [1])); $response = $this->get(route('attachments.download', [1]));
@@ -110,7 +110,7 @@ class AttachmentControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(AttachmentRepositoryInterface::class); $repository = $this->mock(AttachmentRepositoryInterface::class);
$repository->shouldReceive('exists')->once()->andReturn(false); $repository->shouldReceive('exists')->once()->andReturn(false);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('attachments.download', [1])); $response = $this->get(route('attachments.download', [1]));
@@ -125,7 +125,7 @@ class AttachmentControllerTest extends TestCase
$attachRepository = $this->mock(AttachmentRepositoryInterface::class); $attachRepository = $this->mock(AttachmentRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$attachRepository->shouldReceive('getNoteText')->andReturn('OK'); $attachRepository->shouldReceive('getNoteText')->andReturn('OK');
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('attachments.edit', [1])); $response = $this->get(route('attachments.edit', [1]));
$response->assertStatus(200); $response->assertStatus(200);
@@ -142,7 +142,7 @@ class AttachmentControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(AttachmentRepositoryInterface::class); $repository = $this->mock(AttachmentRepositoryInterface::class);
$repository->shouldReceive('update')->once(); $repository->shouldReceive('update')->once();
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->session(['attachments.edit.uri' => 'http://localhost']); $this->session(['attachments.edit.uri' => 'http://localhost']);
$data = [ $data = [
@@ -168,7 +168,7 @@ class AttachmentControllerTest extends TestCase
$repository->shouldReceive('getContent')->once()->andReturn('This is attachment number one.'); $repository->shouldReceive('getContent')->once()->andReturn('This is attachment number one.');
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('attachments.view', [3])); $response = $this->get(route('attachments.view', [3]));
$response->assertStatus(200); $response->assertStatus(200);
@@ -184,7 +184,7 @@ class AttachmentControllerTest extends TestCase
$repository->shouldReceive('exists')->once()->andReturn(false); $repository->shouldReceive('exists')->once()->andReturn(false);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('attachments.view', [1])); $response = $this->get(route('attachments.view', [1]));
$response->assertStatus(500); $response->assertStatus(500);

View File

@@ -41,7 +41,7 @@ class ForgotPasswordControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -43,7 +43,7 @@ class TwoFactorControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -50,7 +50,7 @@ class BillControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -62,7 +62,7 @@ class BillControllerTest extends TestCase
// mock stuff // mock stuff
$attachHelper = $this->mock(AttachmentHelperInterface::class); $attachHelper = $this->mock(AttachmentHelperInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('bills.create')); $response = $this->get(route('bills.create'));
@@ -79,7 +79,7 @@ class BillControllerTest extends TestCase
// mock stuff // mock stuff
$attachHelper = $this->mock(AttachmentHelperInterface::class); $attachHelper = $this->mock(AttachmentHelperInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('bills.delete', [1])); $response = $this->get(route('bills.delete', [1]));
@@ -98,7 +98,7 @@ class BillControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(BillRepositoryInterface::class); $repository = $this->mock(BillRepositoryInterface::class);
$repository->shouldReceive('destroy')->andReturn(true); $repository->shouldReceive('destroy')->andReturn(true);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->session(['bills.delete.uri' => 'http://localhost']); $this->session(['bills.delete.uri' => 'http://localhost']);
$this->be($this->user()); $this->be($this->user());
@@ -115,7 +115,7 @@ class BillControllerTest extends TestCase
// mock stuff // mock stuff
$attachHelper = $this->mock(AttachmentHelperInterface::class); $attachHelper = $this->mock(AttachmentHelperInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('bills.edit', [1])); $response = $this->get(route('bills.edit', [1]));
@@ -135,7 +135,7 @@ class BillControllerTest extends TestCase
$bill = factory(Bill::class)->make(); $bill = factory(Bill::class)->make();
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(BillRepositoryInterface::class); $repository = $this->mock(BillRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$collection = new Collection([$bill]); $collection = new Collection([$bill]);
$repository->shouldReceive('getPaginator')->andReturn(new LengthAwarePaginator($collection, 1, 50))->once(); $repository->shouldReceive('getPaginator')->andReturn(new LengthAwarePaginator($collection, 1, 50))->once();
$repository->shouldReceive('setUser'); $repository->shouldReceive('setUser');
@@ -160,7 +160,7 @@ class BillControllerTest extends TestCase
$journal = factory(TransactionJournal::class)->make(); $journal = factory(TransactionJournal::class)->make();
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(BillRepositoryInterface::class); $repository = $this->mock(BillRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('getRulesForBill')->andReturn(new Collection); $repository->shouldReceive('getRulesForBill')->andReturn(new Collection);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('bills.rescan', [1])); $response = $this->get(route('bills.rescan', [1]));
@@ -177,7 +177,7 @@ class BillControllerTest extends TestCase
$attachHelper = $this->mock(AttachmentHelperInterface::class); $attachHelper = $this->mock(AttachmentHelperInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(BillRepositoryInterface::class); $repository = $this->mock(BillRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('bills.rescan', [3])); $response = $this->get(route('bills.rescan', [3]));
@@ -199,7 +199,7 @@ class BillControllerTest extends TestCase
$repository->shouldReceive('getOverallAverage')->andReturn('0'); $repository->shouldReceive('getOverallAverage')->andReturn('0');
$repository->shouldReceive('nextExpectedMatch')->andReturn(new Carbon); $repository->shouldReceive('nextExpectedMatch')->andReturn(new Carbon);
$repository->shouldReceive('getRulesForBill')->andReturn(new Collection); $repository->shouldReceive('getRulesForBill')->andReturn(new Collection);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf(); $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
$collector->shouldReceive('setBills')->andReturnSelf(); $collector->shouldReceive('setBills')->andReturnSelf();
@@ -229,7 +229,7 @@ class BillControllerTest extends TestCase
$attachHelper = $this->mock(AttachmentHelperInterface::class); $attachHelper = $this->mock(AttachmentHelperInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(BillRepositoryInterface::class); $repository = $this->mock(BillRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('store')->andReturn(new Bill); $repository->shouldReceive('store')->andReturn(new Bill);
$attachHelper->shouldReceive('saveAttachmentsForModel'); $attachHelper->shouldReceive('saveAttachmentsForModel');
$attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag); $attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag);
@@ -262,7 +262,7 @@ class BillControllerTest extends TestCase
$attachHelper = $this->mock(AttachmentHelperInterface::class); $attachHelper = $this->mock(AttachmentHelperInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(BillRepositoryInterface::class); $repository = $this->mock(BillRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('update')->andReturn(new Bill); $repository->shouldReceive('update')->andReturn(new Bill);
$attachHelper->shouldReceive('saveAttachmentsForModel'); $attachHelper->shouldReceive('saveAttachmentsForModel');
$attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag); $attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag);

View File

@@ -50,7 +50,7 @@ class BudgetControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -62,7 +62,7 @@ class BudgetControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('updateLimitAmount')->andReturn(new BudgetLimit); $repository->shouldReceive('updateLimitAmount')->andReturn(new BudgetLimit);
$repository->shouldReceive('spentInPeriod')->andReturn('0'); $repository->shouldReceive('spentInPeriod')->andReturn('0');
$repository->shouldReceive('budgetedPerDay')->andReturn('10'); $repository->shouldReceive('budgetedPerDay')->andReturn('10');
@@ -82,7 +82,7 @@ class BudgetControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('updateLimitAmount')->andReturn(new BudgetLimit); $repository->shouldReceive('updateLimitAmount')->andReturn(new BudgetLimit);
$repository->shouldReceive('spentInPeriod')->andReturn('0'); $repository->shouldReceive('spentInPeriod')->andReturn('0');
$repository->shouldReceive('budgetedPerDay')->andReturn('10'); $repository->shouldReceive('budgetedPerDay')->andReturn('10');
@@ -101,7 +101,7 @@ class BudgetControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('budgets.create')); $response = $this->get(route('budgets.create'));
@@ -118,7 +118,7 @@ class BudgetControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('budgets.delete', [1])); $response = $this->get(route('budgets.delete', [1]));
@@ -135,7 +135,7 @@ class BudgetControllerTest extends TestCase
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('destroy')->andReturn(true); $repository->shouldReceive('destroy')->andReturn(true);
@@ -154,7 +154,7 @@ class BudgetControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('budgets.edit', [1])); $response = $this->get(route('budgets.edit', [1]));
@@ -190,7 +190,7 @@ class BudgetControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection); $accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);
$repository->shouldReceive('cleanupBudgets'); $repository->shouldReceive('cleanupBudgets');
@@ -236,7 +236,7 @@ class BudgetControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection); $accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);
$repository->shouldReceive('cleanupBudgets'); $repository->shouldReceive('cleanupBudgets');
@@ -282,7 +282,7 @@ class BudgetControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection); $accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);
$repository->shouldReceive('cleanupBudgets'); $repository->shouldReceive('cleanupBudgets');
@@ -354,7 +354,7 @@ class BudgetControllerTest extends TestCase
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(TransactionJournal::first());
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf(); $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
$collector->shouldReceive('setRange')->andReturnSelf(); $collector->shouldReceive('setRange')->andReturnSelf();
@@ -389,7 +389,7 @@ class BudgetControllerTest extends TestCase
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(TransactionJournal::first());
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf(); $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
$collector->shouldReceive('setRange')->andReturnSelf(); $collector->shouldReceive('setRange')->andReturnSelf();
@@ -426,7 +426,7 @@ class BudgetControllerTest extends TestCase
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(TransactionJournal::first());
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf(); $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
$collector->shouldReceive('setRange')->andReturnSelf(); $collector->shouldReceive('setRange')->andReturnSelf();
@@ -457,7 +457,7 @@ class BudgetControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('setAvailableBudget'); $repository->shouldReceive('setAvailableBudget');
$repository->shouldReceive('cleanupBudgets'); $repository->shouldReceive('cleanupBudgets');
@@ -481,7 +481,7 @@ class BudgetControllerTest extends TestCase
$budgetLimit = factory(BudgetLimit::class)->make(); $budgetLimit = factory(BudgetLimit::class)->make();
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf(); $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
@@ -519,7 +519,7 @@ class BudgetControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('budgets.show.limit', [1, 8])); $response = $this->get(route('budgets.show.limit', [1, 8]));
@@ -536,7 +536,7 @@ class BudgetControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
// mock account repository // mock account repository
$accountRepository = $this->mock(AccountRepositoryInterface::class); $accountRepository = $this->mock(AccountRepositoryInterface::class);
@@ -574,7 +574,7 @@ class BudgetControllerTest extends TestCase
$budget = factory(Budget::class)->make(); $budget = factory(Budget::class)->make();
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('findNull')->andReturn($budget); $repository->shouldReceive('findNull')->andReturn($budget);
$repository->shouldReceive('store')->andReturn($budget); $repository->shouldReceive('store')->andReturn($budget);
$repository->shouldReceive('cleanupBudgets'); $repository->shouldReceive('cleanupBudgets');
@@ -599,7 +599,7 @@ class BudgetControllerTest extends TestCase
$budget = factory(Budget::class)->make(); $budget = factory(Budget::class)->make();
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('findNull')->andReturn($budget); $repository->shouldReceive('findNull')->andReturn($budget);
$repository->shouldReceive('update'); $repository->shouldReceive('update');
$repository->shouldReceive('cleanupBudgets'); $repository->shouldReceive('cleanupBudgets');
@@ -627,7 +627,7 @@ class BudgetControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(BudgetRepositoryInterface::class); $repository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('getAvailableBudget')->andReturn('1'); $repository->shouldReceive('getAvailableBudget')->andReturn('1');
$repository->shouldReceive('cleanupBudgets'); $repository->shouldReceive('cleanupBudgets');

View File

@@ -52,7 +52,7 @@ class CategoryControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**
@@ -64,7 +64,7 @@ class CategoryControllerTest extends TestCase
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(TransactionJournal::first());
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('categories.create')); $response = $this->get(route('categories.create'));
@@ -82,7 +82,7 @@ class CategoryControllerTest extends TestCase
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(TransactionJournal::first());
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('categories.delete', [1])); $response = $this->get(route('categories.delete', [1]));
@@ -100,7 +100,7 @@ class CategoryControllerTest extends TestCase
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(TransactionJournal::first());
$categoryRepos->shouldReceive('destroy')->andReturn(true); $categoryRepos->shouldReceive('destroy')->andReturn(true);
@@ -120,7 +120,7 @@ class CategoryControllerTest extends TestCase
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(TransactionJournal::first());
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('categories.edit', [1])); $response = $this->get(route('categories.edit', [1]));
@@ -140,7 +140,7 @@ class CategoryControllerTest extends TestCase
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(TransactionJournal::first());
$categoryRepos->shouldReceive('getCategories')->andReturn(new Collection([$category]))->once(); $categoryRepos->shouldReceive('getCategories')->andReturn(new Collection([$category]))->once();
$categoryRepos->shouldReceive('lastUseDate')->andReturn(new Carbon)->once(); $categoryRepos->shouldReceive('lastUseDate')->andReturn(new Carbon)->once();
@@ -165,7 +165,7 @@ class CategoryControllerTest extends TestCase
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->twice()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->twice()->andReturn(TransactionJournal::first());
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf(); $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
$collector->shouldReceive('setTypes')->andReturnSelf(); $collector->shouldReceive('setTypes')->andReturnSelf();
@@ -202,7 +202,7 @@ class CategoryControllerTest extends TestCase
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->twice()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->twice()->andReturn(TransactionJournal::first());
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf(); $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
$collector->shouldReceive('setTypes')->andReturnSelf(); $collector->shouldReceive('setTypes')->andReturnSelf();
@@ -238,7 +238,7 @@ class CategoryControllerTest extends TestCase
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->twice()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->twice()->andReturn(TransactionJournal::first());
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf(); $collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
$collector->shouldReceive('setTypes')->andReturnSelf(); $collector->shouldReceive('setTypes')->andReturnSelf();
@@ -281,7 +281,7 @@ class CategoryControllerTest extends TestCase
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->twice()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->twice()->andReturn(TransactionJournal::first());
// mock stuff // mock stuff
$categoryRepos->shouldReceive('spentInPeriod')->andReturn('0'); $categoryRepos->shouldReceive('spentInPeriod')->andReturn('0');
@@ -345,7 +345,7 @@ class CategoryControllerTest extends TestCase
$collector->shouldReceive('setCategory')->andReturnSelf()->once(); $collector->shouldReceive('setCategory')->andReturnSelf()->once();
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10))->once(); $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10))->once();
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(TransactionJournal::first());
$repository->shouldReceive('firstUseDate')->andReturn(new Carbon); $repository->shouldReceive('firstUseDate')->andReturn(new Carbon);
$this->be($this->user()); $this->be($this->user());
@@ -370,7 +370,7 @@ class CategoryControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->twice()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->twice()->andReturn(TransactionJournal::first());
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection); $accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);
@@ -410,7 +410,7 @@ class CategoryControllerTest extends TestCase
public function testShowEmpty(string $range) public function testShowEmpty(string $range)
{ {
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->twice()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->twice()->andReturn(TransactionJournal::first());
// mock stuff // mock stuff
$repository = $this->mock(CategoryRepositoryInterface::class); $repository = $this->mock(CategoryRepositoryInterface::class);
@@ -451,7 +451,7 @@ class CategoryControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$repository = $this->mock(CategoryRepositoryInterface::class); $repository = $this->mock(CategoryRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(TransactionJournal::first());
$repository->shouldReceive('findNull')->andReturn(new Category); $repository->shouldReceive('findNull')->andReturn(new Category);
$repository->shouldReceive('store')->andReturn(new Category); $repository->shouldReceive('store')->andReturn(new Category);
@@ -476,7 +476,7 @@ class CategoryControllerTest extends TestCase
$repository = $this->mock(CategoryRepositoryInterface::class); $repository = $this->mock(CategoryRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(TransactionJournal::first());
$repository->shouldReceive('update'); $repository->shouldReceive('update');
$repository->shouldReceive('findNull')->andReturn($category); $repository->shouldReceive('findNull')->andReturn($category);

View File

@@ -56,7 +56,7 @@ class AccountControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -52,7 +52,7 @@ class BudgetReportControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -48,7 +48,7 @@ class CategoryControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -49,7 +49,7 @@ class CategoryReportControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -46,7 +46,7 @@ class ExpenseReportControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }

View File

@@ -44,7 +44,7 @@ class PiggyBankControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -43,7 +43,7 @@ class ReportControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -53,7 +53,7 @@ class TagReportControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -47,7 +47,7 @@ class CurrencyControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**
@@ -60,7 +60,7 @@ class CurrencyControllerTest extends TestCase
$userRepos = $this->mock(UserRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$userRepos->shouldReceive('hasRole')->once()->andReturn(false); $userRepos->shouldReceive('hasRole')->once()->andReturn(false);
$this->be($this->user()); $this->be($this->user());
@@ -78,7 +78,7 @@ class CurrencyControllerTest extends TestCase
$repository = $this->mock(CurrencyRepositoryInterface::class); $repository = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$userRepos = $this->mock(UserRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('canDeleteCurrency')->andReturn(false); $repository->shouldReceive('canDeleteCurrency')->andReturn(false);
$userRepos->shouldReceive('hasRole')->once()->andReturn(true); $userRepos->shouldReceive('hasRole')->once()->andReturn(true);
@@ -100,7 +100,7 @@ class CurrencyControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('canDeleteCurrency')->andReturn(false); $repository->shouldReceive('canDeleteCurrency')->andReturn(false);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$userRepos->shouldReceive('hasRole')->once()->andReturn(true); $userRepos->shouldReceive('hasRole')->once()->andReturn(true);
$this->session(['currencies.delete.uri' => 'http://localhost']); $this->session(['currencies.delete.uri' => 'http://localhost']);
@@ -120,7 +120,7 @@ class CurrencyControllerTest extends TestCase
$userRepos = $this->mock(UserRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$userRepos->shouldReceive('hasRole')->once()->andReturn(true); $userRepos->shouldReceive('hasRole')->once()->andReturn(true);
$this->be($this->user()); $this->be($this->user());
@@ -140,7 +140,7 @@ class CurrencyControllerTest extends TestCase
$userRepos = $this->mock(UserRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('currencies.default', [1])); $response = $this->get(route('currencies.default', [1]));
@@ -158,7 +158,7 @@ class CurrencyControllerTest extends TestCase
$userRepos = $this->mock(UserRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('canDeleteCurrency')->andReturn(true); $repository->shouldReceive('canDeleteCurrency')->andReturn(true);
$userRepos->shouldReceive('hasRole')->once()->andReturn(true); $userRepos->shouldReceive('hasRole')->once()->andReturn(true);
@@ -181,7 +181,7 @@ class CurrencyControllerTest extends TestCase
$repository->shouldReceive('canDeleteCurrency')->andReturn(true); $repository->shouldReceive('canDeleteCurrency')->andReturn(true);
$repository->shouldReceive('destroy')->andReturn(true)->once(); $repository->shouldReceive('destroy')->andReturn(true)->once();
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$userRepos->shouldReceive('hasRole')->once()->andReturn(true); $userRepos->shouldReceive('hasRole')->once()->andReturn(true);
$this->session(['currencies.delete.uri' => 'http://localhost']); $this->session(['currencies.delete.uri' => 'http://localhost']);
@@ -201,7 +201,7 @@ class CurrencyControllerTest extends TestCase
$userRepos = $this->mock(UserRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$userRepos->shouldReceive('hasRole')->once()->andReturn(true); $userRepos->shouldReceive('hasRole')->once()->andReturn(true);
$this->be($this->user()); $this->be($this->user());
@@ -224,7 +224,7 @@ class CurrencyControllerTest extends TestCase
$currencies = TransactionCurrency::get(); $currencies = TransactionCurrency::get();
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('getCurrencyByPreference')->andReturn($currencies->first()); $repository->shouldReceive('getCurrencyByPreference')->andReturn($currencies->first());
$repository->shouldReceive('get')->andReturn($currencies); $repository->shouldReceive('get')->andReturn($currencies);
$userRepos->shouldReceive('hasRole')->once()->andReturn(true); $userRepos->shouldReceive('hasRole')->once()->andReturn(true);
@@ -247,7 +247,7 @@ class CurrencyControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$userRepos = $this->mock(UserRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('getCurrencyByPreference')->andReturn(new TransactionCurrency); $repository->shouldReceive('getCurrencyByPreference')->andReturn(new TransactionCurrency);
$repository->shouldReceive('get')->andReturn(new Collection); $repository->shouldReceive('get')->andReturn(new Collection);
$userRepos->shouldReceive('hasRole')->once()->andReturn(false); $userRepos->shouldReceive('hasRole')->once()->andReturn(false);
@@ -271,7 +271,7 @@ class CurrencyControllerTest extends TestCase
$userRepos = $this->mock(UserRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('store')->andReturn(new TransactionCurrency); $repository->shouldReceive('store')->andReturn(new TransactionCurrency);
$userRepos->shouldReceive('hasRole')->once()->andReturn(true); $userRepos->shouldReceive('hasRole')->once()->andReturn(true);
@@ -299,7 +299,7 @@ class CurrencyControllerTest extends TestCase
$userRepos = $this->mock(UserRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('store')->andReturn(new TransactionCurrency); $repository->shouldReceive('store')->andReturn(new TransactionCurrency);
$userRepos->shouldReceive('hasRole')->once()->andReturn(true); $userRepos->shouldReceive('hasRole')->once()->andReturn(true);
@@ -327,7 +327,7 @@ class CurrencyControllerTest extends TestCase
$userRepos = $this->mock(UserRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('update')->andReturn(new TransactionCurrency); $repository->shouldReceive('update')->andReturn(new TransactionCurrency);
$userRepos->shouldReceive('hasRole')->once()->andReturn(true); $userRepos->shouldReceive('hasRole')->once()->andReturn(true);

View File

@@ -40,7 +40,7 @@ class DebugControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -49,7 +49,7 @@ class ExportControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**
@@ -60,7 +60,7 @@ class ExportControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(ExportJobRepositoryInterface::class); $repository = $this->mock(ExportJobRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('exists')->once()->andReturn(true); $repository->shouldReceive('exists')->once()->andReturn(true);
$repository->shouldReceive('getContent')->once()->andReturn('Some content beep boop'); $repository->shouldReceive('getContent')->once()->andReturn('Some content beep boop');
@@ -79,7 +79,7 @@ class ExportControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(ExportJobRepositoryInterface::class); $repository = $this->mock(ExportJobRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('exists')->once()->andReturn(false); $repository->shouldReceive('exists')->once()->andReturn(false);
@@ -95,7 +95,7 @@ class ExportControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('export.status', ['testExport'])); $response = $this->get(route('export.status', ['testExport']));
@@ -113,7 +113,7 @@ class ExportControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$job = ExportJob::first(); $job = ExportJob::first();
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('create')->andReturn($job); $repository->shouldReceive('create')->andReturn($job);
$repository->shouldReceive('cleanup'); $repository->shouldReceive('cleanup');
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection); $accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection);
@@ -137,7 +137,7 @@ class ExportControllerTest extends TestCase
$processor = $this->mock(ProcessorInterface::class); $processor = $this->mock(ProcessorInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$this->session( $this->session(
['first' => new Carbon('2014-01-01')] ['first' => new Carbon('2014-01-01')]

View File

@@ -42,7 +42,7 @@ class HelpControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -51,7 +51,7 @@ class HomeControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -63,7 +63,7 @@ class HomeControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
@@ -85,7 +85,7 @@ class HomeControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
@@ -107,7 +107,7 @@ class HomeControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('error')); $response = $this->get(route('error'));
@@ -121,7 +121,7 @@ class HomeControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('flush')); $response = $this->get(route('flush'));
@@ -145,7 +145,7 @@ class HomeControllerTest extends TestCase
$billRepos = $this->mock(BillRepositoryInterface::class); $billRepos = $this->mock(BillRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('count')->andReturn(1); $accountRepos->shouldReceive('count')->andReturn(1);
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1'); $accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1');
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection([$account])); $accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection([$account]));
@@ -178,7 +178,7 @@ class HomeControllerTest extends TestCase
// mock stuff // mock stuff
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('count')->andReturn(0); $accountRepos->shouldReceive('count')->andReturn(0);
$this->be($this->user()); $this->be($this->user());
@@ -204,7 +204,7 @@ class HomeControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('test-flash')); $response = $this->get(route('test-flash'));

View File

@@ -43,7 +43,7 @@ class ConfigurationControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -42,7 +42,7 @@ class IndexControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -42,7 +42,7 @@ class PrerequisitesControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -41,7 +41,7 @@ class StatusControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -47,7 +47,7 @@ class JavascriptControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }

View File

@@ -51,7 +51,7 @@ class AutoCompleteControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**
@@ -98,7 +98,7 @@ class AutoCompleteControllerTest extends TestCase
$budget = factory(Budget::class)->make(); $budget = factory(Budget::class)->make();
$categoryRepos = $this->mock(BudgetRepositoryInterface::class); $categoryRepos = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$categoryRepos->shouldReceive('getBudgets')->andReturn(new Collection([$budget])); $categoryRepos->shouldReceive('getBudgets')->andReturn(new Collection([$budget]));
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('json.budgets')); $response = $this->get(route('json.budgets'));
@@ -115,7 +115,7 @@ class AutoCompleteControllerTest extends TestCase
$category = factory(Category::class)->make(); $category = factory(Category::class)->make();
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$categoryRepos->shouldReceive('getCategories')->andReturn(new Collection([$category])); $categoryRepos->shouldReceive('getCategories')->andReturn(new Collection([$category]));
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('json.categories')); $response = $this->get(route('json.categories'));
@@ -136,7 +136,7 @@ class AutoCompleteControllerTest extends TestCase
$collection = new Collection([$accountA, $accountB]); $collection = new Collection([$accountA, $accountB]);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::EXPENSE, AccountType::BENEFICIARY]])->once()->andReturn($collection); $accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::EXPENSE, AccountType::BENEFICIARY]])->once()->andReturn($collection);
$this->be($this->user()); $this->be($this->user());
@@ -177,7 +177,7 @@ class AutoCompleteControllerTest extends TestCase
$collection = new Collection([$accountA, $accountB]); $collection = new Collection([$accountA, $accountB]);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::REVENUE]])->once()->andReturn($collection); $accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::REVENUE]])->once()->andReturn($collection);
$this->be($this->user()); $this->be($this->user());
@@ -195,7 +195,7 @@ class AutoCompleteControllerTest extends TestCase
$tag = factory(Tag::class)->make(); $tag = factory(Tag::class)->make();
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$tagRepos->shouldReceive('get')->andReturn(new Collection([$tag]))->once(); $tagRepos->shouldReceive('get')->andReturn(new Collection([$tag]))->once();
$this->be($this->user()); $this->be($this->user());
@@ -212,7 +212,7 @@ class AutoCompleteControllerTest extends TestCase
// mock stuff // mock stuff
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$collector->shouldReceive('setTypes')->andReturnSelf(); $collector->shouldReceive('setTypes')->andReturnSelf();
$collector->shouldReceive('setLimit')->andReturnSelf(); $collector->shouldReceive('setLimit')->andReturnSelf();
$collector->shouldReceive('setPage')->andReturnSelf(); $collector->shouldReceive('setPage')->andReturnSelf();
@@ -231,7 +231,7 @@ class AutoCompleteControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getTransactionTypes')->once()->andReturn(new Collection); $journalRepos->shouldReceive('getTransactionTypes')->once()->andReturn(new Collection);
$this->be($this->user()); $this->be($this->user());

View File

@@ -45,7 +45,7 @@ class BoxControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -42,7 +42,7 @@ class ExchangeControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -42,7 +42,7 @@ class FrontpageControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -40,7 +40,7 @@ class IntroControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -42,7 +42,7 @@ class JsonControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**
@@ -53,7 +53,7 @@ class JsonControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('json.action')); $response = $this->get(route('json.action'));
@@ -67,7 +67,7 @@ class JsonControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('json.trigger')); $response = $this->get(route('json.trigger'));

View File

@@ -45,7 +45,7 @@ class NewUserControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -58,7 +58,7 @@ class NewUserControllerTest extends TestCase
// mock stuff // mock stuff
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('count')->andReturn(0); $accountRepos->shouldReceive('count')->andReturn(0);
$this->be($this->emptyUser()); $this->be($this->emptyUser());
@@ -76,7 +76,7 @@ class NewUserControllerTest extends TestCase
// mock stuff // mock stuff
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('count')->andReturn(1); $accountRepos->shouldReceive('count')->andReturn(1);
$this->be($this->user()); $this->be($this->user());
@@ -96,7 +96,7 @@ class NewUserControllerTest extends TestCase
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('store')->times(3); $accountRepos->shouldReceive('store')->times(3);
$currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1)); $currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));
@@ -122,7 +122,7 @@ class NewUserControllerTest extends TestCase
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('store')->times(3); $accountRepos->shouldReceive('store')->times(3);
$currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1)); $currencyRepos->shouldReceive('findNull')->andReturn(TransactionCurrency::find(1));

View File

@@ -52,7 +52,7 @@ class PiggyBankControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -64,7 +64,7 @@ class PiggyBankControllerTest extends TestCase
// mock stuff // mock stuff
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class); $piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$piggyRepos->shouldReceive('getCurrentAmount')->andReturn('0'); $piggyRepos->shouldReceive('getCurrentAmount')->andReturn('0');
$piggyRepos->shouldReceive('leftOnAccount')->andReturn('0'); $piggyRepos->shouldReceive('leftOnAccount')->andReturn('0');
@@ -81,7 +81,7 @@ class PiggyBankControllerTest extends TestCase
// mock stuff // mock stuff
$piggyRepos = $this->mock(PiggyBankRepositoryInterface::class); $piggyRepos = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$piggyRepos->shouldReceive('getCurrentAmount')->andReturn('0'); $piggyRepos->shouldReceive('getCurrentAmount')->andReturn('0');
$piggyRepos->shouldReceive('leftOnAccount')->andReturn('0'); $piggyRepos->shouldReceive('leftOnAccount')->andReturn('0');
@@ -114,7 +114,7 @@ class PiggyBankControllerTest extends TestCase
Amount::shouldReceive('getDefaultCurrency')->andReturn($currency); Amount::shouldReceive('getDefaultCurrency')->andReturn($currency);
Amount::shouldReceive('balance')->andReturn('0'); Amount::shouldReceive('balance')->andReturn('0');
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
@@ -130,7 +130,7 @@ class PiggyBankControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('piggy-banks.delete', [1])); $response = $this->get(route('piggy-banks.delete', [1]));
@@ -146,7 +146,7 @@ class PiggyBankControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(PiggyBankRepositoryInterface::class); $repository = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('destroy')->andReturn(true); $repository->shouldReceive('destroy')->andReturn(true);
@@ -166,7 +166,7 @@ class PiggyBankControllerTest extends TestCase
// mock stuff // mock stuff
$account = factory(Account::class)->make(); $account = factory(Account::class)->make();
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
// mock stuff for new account list thing. // mock stuff for new account list thing.
$currency = TransactionCurrency::first(); $currency = TransactionCurrency::first();
@@ -200,7 +200,7 @@ class PiggyBankControllerTest extends TestCase
$one = factory(PiggyBank::class)->make(); $one = factory(PiggyBank::class)->make();
$two = factory(PiggyBank::class)->make(); $two = factory(PiggyBank::class)->make();
$two->account_id = $one->account_id; $two->account_id = $one->account_id;
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('getPiggyBanks')->andReturn(new Collection([$one, $two])); $repository->shouldReceive('getPiggyBanks')->andReturn(new Collection([$one, $two]));
$repository->shouldReceive('getCurrentAmount')->andReturn('10'); $repository->shouldReceive('getCurrentAmount')->andReturn('10');
$repository->shouldReceive('setUser'); $repository->shouldReceive('setUser');
@@ -221,7 +221,7 @@ class PiggyBankControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(PiggyBankRepositoryInterface::class); $repository = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('reset'); $repository->shouldReceive('reset');
$repository->shouldReceive('setOrder')->times(2); $repository->shouldReceive('setOrder')->times(2);
@@ -238,7 +238,7 @@ class PiggyBankControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(PiggyBankRepositoryInterface::class); $repository = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('canAddAmount')->once()->andReturn(true); $repository->shouldReceive('canAddAmount')->once()->andReturn(true);
$repository->shouldReceive('addAmount')->once()->andReturn(true); $repository->shouldReceive('addAmount')->once()->andReturn(true);
@@ -260,7 +260,7 @@ class PiggyBankControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(PiggyBankRepositoryInterface::class); $repository = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('canAddAmount')->once()->andReturn(false); $repository->shouldReceive('canAddAmount')->once()->andReturn(false);
$data = ['amount' => '1000']; $data = ['amount' => '1000'];
@@ -279,7 +279,7 @@ class PiggyBankControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(PiggyBankRepositoryInterface::class); $repository = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('canRemoveAmount')->once()->andReturn(true); $repository->shouldReceive('canRemoveAmount')->once()->andReturn(true);
$repository->shouldReceive('removeAmount')->once()->andReturn(true); $repository->shouldReceive('removeAmount')->once()->andReturn(true);
@@ -299,7 +299,7 @@ class PiggyBankControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(PiggyBankRepositoryInterface::class); $repository = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('canRemoveAmount')->once()->andReturn(false); $repository->shouldReceive('canRemoveAmount')->once()->andReturn(false);
$data = ['amount' => '1.123']; $data = ['amount' => '1.123'];
@@ -317,7 +317,7 @@ class PiggyBankControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('piggy-banks.remove', [1])); $response = $this->get(route('piggy-banks.remove', [1]));
@@ -331,7 +331,7 @@ class PiggyBankControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('piggy-banks.remove-money-mobile', [1])); $response = $this->get(route('piggy-banks.remove-money-mobile', [1]));
@@ -347,7 +347,7 @@ class PiggyBankControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(PiggyBankRepositoryInterface::class); $repository = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('getEvents')->andReturn(new Collection); $repository->shouldReceive('getEvents')->andReturn(new Collection);
$this->be($this->user()); $this->be($this->user());
@@ -365,7 +365,7 @@ class PiggyBankControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(PiggyBankRepositoryInterface::class); $repository = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('store')->andReturn(new PiggyBank); $repository->shouldReceive('store')->andReturn(new PiggyBank);
$this->session(['piggy-banks.create.uri' => 'http://localhost']); $this->session(['piggy-banks.create.uri' => 'http://localhost']);
@@ -391,7 +391,7 @@ class PiggyBankControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(PiggyBankRepositoryInterface::class); $repository = $this->mock(PiggyBankRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('update')->andReturn(new PiggyBank); $repository->shouldReceive('update')->andReturn(new PiggyBank);
$this->session(['piggy-banks.edit.uri' => 'http://localhost']); $this->session(['piggy-banks.edit.uri' => 'http://localhost']);

View File

@@ -49,7 +49,7 @@ class ReportControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -46,7 +46,7 @@ class PreferencesControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -59,7 +59,7 @@ class PreferencesControllerTest extends TestCase
// mock stuff // mock stuff
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection)->once(); $accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection)->once();
$this->be($this->user()); $this->be($this->user());
@@ -76,7 +76,7 @@ class PreferencesControllerTest extends TestCase
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$userRepos = $this->mock(UserRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$userRepos->shouldReceive('hasRole')->andReturn(false); $userRepos->shouldReceive('hasRole')->andReturn(false);
$data = [ $data = [

View File

@@ -48,7 +48,7 @@ class ProfileControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**
@@ -69,7 +69,7 @@ class ProfileControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('profile.change-password')); $response = $this->get(route('profile.change-password'));
@@ -85,7 +85,7 @@ class ProfileControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
Google2FA::shouldReceive('generateSecretKey')->andReturn('secret'); Google2FA::shouldReceive('generateSecretKey')->andReturn('secret');
Google2FA::shouldReceive('getQRCodeInline')->andReturn('long-data-url'); Google2FA::shouldReceive('getQRCodeInline')->andReturn('long-data-url');
@@ -132,7 +132,7 @@ class ProfileControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('profile.delete-account')); $response = $this->get(route('profile.delete-account'));
@@ -147,7 +147,7 @@ class ProfileControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('profile.delete-code')); $response = $this->get(route('profile.delete-code'));
@@ -167,7 +167,7 @@ class ProfileControllerTest extends TestCase
Preference::where('user_id', $this->user()->id)->where('name', 'access_token')->delete(); Preference::where('user_id', $this->user()->id)->where('name', 'access_token')->delete();
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('profile.index')); $response = $this->get(route('profile.index'));
@@ -237,7 +237,7 @@ class ProfileControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository = $this->mock(UserRepositoryInterface::class); $repository = $this->mock(UserRepositoryInterface::class);
$repository->shouldReceive('changePassword'); $repository->shouldReceive('changePassword');
@@ -260,7 +260,7 @@ class ProfileControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository = $this->mock(UserRepositoryInterface::class); $repository = $this->mock(UserRepositoryInterface::class);
$repository->shouldReceive('changePassword'); $repository->shouldReceive('changePassword');
@@ -283,7 +283,7 @@ class ProfileControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository = $this->mock(UserRepositoryInterface::class); $repository = $this->mock(UserRepositoryInterface::class);
$repository->shouldReceive('changePassword'); $repository->shouldReceive('changePassword');
@@ -332,7 +332,7 @@ class ProfileControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository = $this->mock(UserRepositoryInterface::class); $repository = $this->mock(UserRepositoryInterface::class);
$repository->shouldReceive('destroy')->once(); $repository->shouldReceive('destroy')->once();
$data = [ $data = [
@@ -352,7 +352,7 @@ class ProfileControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(UserRepositoryInterface::class); $repository = $this->mock(UserRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$data = [ $data = [
'password' => 'james2', 'password' => 'james2',
]; ];

View File

@@ -41,7 +41,7 @@ class AccountControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
/** /**

View File

@@ -42,7 +42,7 @@ class BalanceControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }

View File

@@ -43,7 +43,7 @@ class BudgetControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }

View File

@@ -43,7 +43,7 @@ class CategoryControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }

View File

@@ -45,7 +45,7 @@ class ExpenseControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }

View File

@@ -41,7 +41,7 @@ class OperationsControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }

View File

@@ -59,7 +59,7 @@ class ReportControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -73,7 +73,7 @@ class ReportControllerTest extends TestCase
$generator = $this->mock(AcYRG::class); $generator = $this->mock(AcYRG::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$generator->shouldReceive('setStartDate')->once(); $generator->shouldReceive('setStartDate')->once();
@@ -97,7 +97,7 @@ class ReportControllerTest extends TestCase
$generator = $this->mock(AYRG::class); $generator = $this->mock(AYRG::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$generator->shouldReceive('setStartDate')->once(); $generator->shouldReceive('setStartDate')->once();
$generator->shouldReceive('setEndDate')->once(); $generator->shouldReceive('setEndDate')->once();
@@ -119,7 +119,7 @@ class ReportControllerTest extends TestCase
$generator = $this->mock(BYRG::class); $generator = $this->mock(BYRG::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$generator->shouldReceive('setStartDate')->once(); $generator->shouldReceive('setStartDate')->once();
$generator->shouldReceive('setEndDate')->once(); $generator->shouldReceive('setEndDate')->once();
$generator->shouldReceive('setAccounts')->once(); $generator->shouldReceive('setAccounts')->once();
@@ -141,7 +141,7 @@ class ReportControllerTest extends TestCase
$generator = $this->mock(CYRG::class); $generator = $this->mock(CYRG::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$generator->shouldReceive('setStartDate')->once(); $generator->shouldReceive('setStartDate')->once();
$generator->shouldReceive('setEndDate')->once(); $generator->shouldReceive('setEndDate')->once();
$generator->shouldReceive('setAccounts')->once(); $generator->shouldReceive('setAccounts')->once();
@@ -163,7 +163,7 @@ class ReportControllerTest extends TestCase
$generator = $this->mock(SYRG::class); $generator = $this->mock(SYRG::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$generator->shouldReceive('setStartDate')->once(); $generator->shouldReceive('setStartDate')->once();
$generator->shouldReceive('setEndDate')->once(); $generator->shouldReceive('setEndDate')->once();
$generator->shouldReceive('setAccounts')->once(); $generator->shouldReceive('setAccounts')->once();
@@ -183,7 +183,7 @@ class ReportControllerTest extends TestCase
$budgetRepository->shouldReceive('cleanupBudgets'); $budgetRepository->shouldReceive('cleanupBudgets');
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('reports.report.default', [1, '20160101', '20150131'])); $response = $this->get(route('reports.report.default', [1, '20160101', '20150131']));
@@ -203,7 +203,7 @@ class ReportControllerTest extends TestCase
$helper = $this->mock(ReportHelperInterface::class); $helper = $this->mock(ReportHelperInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$helper->shouldReceive('listOfMonths')->andReturn([]); $helper->shouldReceive('listOfMonths')->andReturn([]);
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection)->once(); $accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection)->once();
@@ -222,7 +222,7 @@ class ReportControllerTest extends TestCase
$budgetRepository = $this->mock(BudgetRepositoryInterface::class); $budgetRepository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('reports.options', ['default'])); $response = $this->get(route('reports.options', ['default']));
@@ -243,7 +243,7 @@ class ReportControllerTest extends TestCase
$collection = new Collection([$account]); $collection = new Collection([$account]);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository = $this->mock(AccountRepositoryInterface::class); $repository = $this->mock(AccountRepositoryInterface::class);
$repository->shouldReceive('getActiveAccountsByType')->withArgs([[AccountType::EXPENSE]])->once()->andReturn($collection); $repository->shouldReceive('getActiveAccountsByType')->withArgs([[AccountType::EXPENSE]])->once()->andReturn($collection);
$repository->shouldReceive('getActiveAccountsByType')->withArgs([[AccountType::REVENUE]])->once()->andReturn($collection); $repository->shouldReceive('getActiveAccountsByType')->withArgs([[AccountType::REVENUE]])->once()->andReturn($collection);
@@ -262,7 +262,7 @@ class ReportControllerTest extends TestCase
$budgetRepository = $this->mock(BudgetRepositoryInterface::class); $budgetRepository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$budgetRepos = $this->mock(BudgetRepositoryInterface::class); $budgetRepos = $this->mock(BudgetRepositoryInterface::class);
$budget = factory(Budget::class)->make(); $budget = factory(Budget::class)->make();
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection([$budget])); $budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection([$budget]));
@@ -282,7 +282,7 @@ class ReportControllerTest extends TestCase
$budgetRepository = $this->mock(BudgetRepositoryInterface::class); $budgetRepository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$category = factory(Category::class)->make(); $category = factory(Category::class)->make();
$categoryRepos->shouldReceive('getCategories')->andReturn(new Collection([$category])); $categoryRepos->shouldReceive('getCategories')->andReturn(new Collection([$category]));
@@ -301,7 +301,7 @@ class ReportControllerTest extends TestCase
$budgetRepository = $this->mock(BudgetRepositoryInterface::class); $budgetRepository = $this->mock(BudgetRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$tag = factory(Tag::class)->make(); $tag = factory(Tag::class)->make();
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$tagRepos->shouldReceive('get')->andReturn(new Collection([$tag])); $tagRepos->shouldReceive('get')->andReturn(new Collection([$tag]));
@@ -323,7 +323,7 @@ class ReportControllerTest extends TestCase
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->times(3); $accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->times(3);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$data = [ $data = [
'accounts' => ['1'], 'accounts' => ['1'],
@@ -349,7 +349,7 @@ class ReportControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice(); $accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
$data = [ $data = [
@@ -376,7 +376,7 @@ class ReportControllerTest extends TestCase
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice(); $accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
$data = [ $data = [
@@ -405,7 +405,7 @@ class ReportControllerTest extends TestCase
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice(); $accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
$budgetRepository->shouldReceive('findNull')->andReturn($this->user()->budgets()->find(1))->twice(); $budgetRepository->shouldReceive('findNull')->andReturn($this->user()->budgets()->find(1))->twice();
@@ -434,7 +434,7 @@ class ReportControllerTest extends TestCase
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice(); $accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
$data = [ $data = [
@@ -462,7 +462,7 @@ class ReportControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$categoryRepos->shouldReceive('findNull')->andReturn($this->user()->categories()->find(1))->twice(); $categoryRepos->shouldReceive('findNull')->andReturn($this->user()->categories()->find(1))->twice();
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice(); $accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
@@ -490,7 +490,7 @@ class ReportControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice(); $accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
$data = [ $data = [
@@ -516,7 +516,7 @@ class ReportControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice(); $accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
$data = [ $data = [
@@ -542,7 +542,7 @@ class ReportControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice(); $accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
$data = [ $data = [
@@ -571,7 +571,7 @@ class ReportControllerTest extends TestCase
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$tag = $this->user()->tags()->find(1); $tag = $this->user()->tags()->find(1);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice(); $accountRepos->shouldReceive('findNull')->andReturn($this->user()->accounts()->find(1))->twice();
$tagRepos->shouldReceive('findByTag')->andReturn($tag)->twice(); $tagRepos->shouldReceive('findByTag')->andReturn($tag)->twice();
@@ -599,7 +599,7 @@ class ReportControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$categoryRepos = $this->mock(CategoryRepositoryInterface::class); $categoryRepos = $this->mock(CategoryRepositoryInterface::class);
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$data = [ $data = [
'accounts' => [], 'accounts' => [],
@@ -631,7 +631,7 @@ class ReportControllerTest extends TestCase
$tagRepos->shouldReceive('get')->andReturn(new Collection([$tag])); $tagRepos->shouldReceive('get')->andReturn(new Collection([$tag]));
$budgetRepository->shouldReceive('cleanupBudgets'); $budgetRepository->shouldReceive('cleanupBudgets');
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$generator->shouldReceive('setStartDate')->once(); $generator->shouldReceive('setStartDate')->once();
$generator->shouldReceive('setEndDate')->once(); $generator->shouldReceive('setEndDate')->once();
$generator->shouldReceive('setAccounts')->once(); $generator->shouldReceive('setAccounts')->once();

View File

@@ -53,7 +53,7 @@ class RuleControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -64,7 +64,7 @@ class RuleControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('rules.create', [1])); $response = $this->get(route('rules.create', [1]));
@@ -91,7 +91,7 @@ class RuleControllerTest extends TestCase
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('rules.create', [1])); $response = $this->get(route('rules.create', [1]));
@@ -106,7 +106,7 @@ class RuleControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('rules.delete', [1])); $response = $this->get(route('rules.delete', [1]));
@@ -122,7 +122,7 @@ class RuleControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(RuleRepositoryInterface::class); $repository = $this->mock(RuleRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('destroy'); $repository->shouldReceive('destroy');
$this->session(['rules.delete.uri' => 'http://localhost']); $this->session(['rules.delete.uri' => 'http://localhost']);
@@ -141,7 +141,7 @@ class RuleControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(RuleRepositoryInterface::class); $repository = $this->mock(RuleRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('moveDown'); $repository->shouldReceive('moveDown');
$this->be($this->user()); $this->be($this->user());
@@ -161,7 +161,7 @@ class RuleControllerTest extends TestCase
$groupRepos = $this->mock(RuleGroupRepositoryInterface::class); $groupRepos = $this->mock(RuleGroupRepositoryInterface::class);
$repository = $this->mock(RuleRepositoryInterface::class); $repository = $this->mock(RuleRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('getPrimaryTrigger')->andReturn(new Rule); $repository->shouldReceive('getPrimaryTrigger')->andReturn(new Rule);
$groupRepos->shouldReceive('get')->andReturn(new Collection); $groupRepos->shouldReceive('get')->andReturn(new Collection);
@@ -192,7 +192,7 @@ class RuleControllerTest extends TestCase
$groupRepos = $this->mock(RuleGroupRepositoryInterface::class); $groupRepos = $this->mock(RuleGroupRepositoryInterface::class);
$repository = $this->mock(RuleRepositoryInterface::class); $repository = $this->mock(RuleRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('getPrimaryTrigger')->andReturn(new Rule); $repository->shouldReceive('getPrimaryTrigger')->andReturn(new Rule);
$groupRepos->shouldReceive('get')->andReturn(new Collection); $groupRepos->shouldReceive('get')->andReturn(new Collection);
@@ -244,7 +244,7 @@ class RuleControllerTest extends TestCase
$repository = $this->mock(RuleRepositoryInterface::class); $repository = $this->mock(RuleRepositoryInterface::class);
$ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class); $ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$ruleGroupRepos->shouldReceive('count')->andReturn(0); $ruleGroupRepos->shouldReceive('count')->andReturn(0);
$ruleGroupRepos->shouldReceive('store'); $ruleGroupRepos->shouldReceive('store');
$repository->shouldReceive('getFirstRuleGroup')->andReturn(new RuleGroup); $repository->shouldReceive('getFirstRuleGroup')->andReturn(new RuleGroup);
@@ -266,7 +266,7 @@ class RuleControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(RuleRepositoryInterface::class); $repository = $this->mock(RuleRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$data = ['actions' => [1, 2, 3]]; $data = ['actions' => [1, 2, 3]];
$repository->shouldReceive('reorderRuleActions')->once(); $repository->shouldReceive('reorderRuleActions')->once();
@@ -285,7 +285,7 @@ class RuleControllerTest extends TestCase
$repository = $this->mock(RuleRepositoryInterface::class); $repository = $this->mock(RuleRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$data = ['triggers' => [1, 2, 3]]; $data = ['triggers' => [1, 2, 3]];
$repository->shouldReceive('reorderRuleTriggers')->once(); $repository->shouldReceive('reorderRuleTriggers')->once();
@@ -318,7 +318,7 @@ class RuleControllerTest extends TestCase
$repository = $this->mock(RuleRepositoryInterface::class); $repository = $this->mock(RuleRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('store')->andReturn(new Rule); $repository->shouldReceive('store')->andReturn(new Rule);
$repository->shouldReceive('find')->withArgs([0])->andReturn(new Rule)->once(); $repository->shouldReceive('find')->withArgs([0])->andReturn(new Rule)->once();
@@ -363,7 +363,7 @@ class RuleControllerTest extends TestCase
// mock stuff // mock stuff
$matcher = $this->mock(TransactionMatcher::class); $matcher = $this->mock(TransactionMatcher::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$matcher->shouldReceive('setLimit')->withArgs([10])->andReturnSelf()->once(); $matcher->shouldReceive('setLimit')->withArgs([10])->andReturnSelf()->once();
$matcher->shouldReceive('setRange')->withArgs([200])->andReturnSelf()->once(); $matcher->shouldReceive('setRange')->withArgs([200])->andReturnSelf()->once();
@@ -404,7 +404,7 @@ class RuleControllerTest extends TestCase
public function testTestTriggersError() public function testTestTriggersError()
{ {
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$uri = route('rules.test-triggers'); $uri = route('rules.test-triggers');
@@ -428,7 +428,7 @@ class RuleControllerTest extends TestCase
// mock stuff // mock stuff
$matcher = $this->mock(TransactionMatcher::class); $matcher = $this->mock(TransactionMatcher::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$matcher->shouldReceive('setLimit')->withArgs([10])->andReturnSelf()->once(); $matcher->shouldReceive('setLimit')->withArgs([10])->andReturnSelf()->once();
$matcher->shouldReceive('setRange')->withArgs([200])->andReturnSelf()->once(); $matcher->shouldReceive('setRange')->withArgs([200])->andReturnSelf()->once();
@@ -449,7 +449,7 @@ class RuleControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(RuleRepositoryInterface::class); $repository = $this->mock(RuleRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('moveUp'); $repository->shouldReceive('moveUp');
$this->be($this->user()); $this->be($this->user());
@@ -468,7 +468,7 @@ class RuleControllerTest extends TestCase
$repository = $this->mock(RuleRepositoryInterface::class); $repository = $this->mock(RuleRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$rule = Rule::find(1); $rule = Rule::find(1);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('find')->withArgs([1])->andReturn($rule)->once(); $repository->shouldReceive('find')->withArgs([1])->andReturn($rule)->once();
$repository->shouldReceive('update'); $repository->shouldReceive('update');

View File

@@ -48,7 +48,7 @@ class RuleGroupControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -60,7 +60,7 @@ class RuleGroupControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('rule-groups.create')); $response = $this->get(route('rule-groups.create'));
@@ -76,7 +76,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class); $repository = $this->mock(RuleGroupRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('get')->andReturn(new Collection); $repository->shouldReceive('get')->andReturn(new Collection);
$this->be($this->user()); $this->be($this->user());
@@ -93,7 +93,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class); $repository = $this->mock(RuleGroupRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('destroy'); $repository->shouldReceive('destroy');
$this->session(['rule-groups.delete.uri' => 'http://localhost']); $this->session(['rule-groups.delete.uri' => 'http://localhost']);
@@ -112,7 +112,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class); $repository = $this->mock(RuleGroupRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('moveDown'); $repository->shouldReceive('moveDown');
$this->be($this->user()); $this->be($this->user());
@@ -128,7 +128,7 @@ class RuleGroupControllerTest extends TestCase
{ {
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('rule-groups.edit', [1])); $response = $this->get(route('rule-groups.edit', [1]));
@@ -144,7 +144,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection); $accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection);
$this->expectsJobs(ExecuteRuleGroupOnExistingTransactions::class); $this->expectsJobs(ExecuteRuleGroupOnExistingTransactions::class);
@@ -171,7 +171,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection); $accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);
$this->be($this->user()); $this->be($this->user());
@@ -189,7 +189,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class); $repository = $this->mock(RuleGroupRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->session(['rule-groups.create.uri' => 'http://localhost']); $this->session(['rule-groups.create.uri' => 'http://localhost']);
$repository->shouldReceive('store')->andReturn(new RuleGroup); $repository->shouldReceive('store')->andReturn(new RuleGroup);
@@ -213,7 +213,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class); $repository = $this->mock(RuleGroupRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('moveUp'); $repository->shouldReceive('moveUp');
$this->be($this->user()); $this->be($this->user());
@@ -231,7 +231,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff // mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class); $repository = $this->mock(RuleGroupRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$data = [ $data = [
'id' => 1, 'id' => 1,

View File

@@ -42,7 +42,7 @@ class SearchControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }

View File

@@ -48,7 +48,7 @@ class TagControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -60,7 +60,7 @@ class TagControllerTest extends TestCase
// mock stuff // mock stuff
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('tags.create')); $response = $this->get(route('tags.create'));
@@ -76,7 +76,7 @@ class TagControllerTest extends TestCase
// mock stuff // mock stuff
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('tags.delete', [1])); $response = $this->get(route('tags.delete', [1]));
@@ -92,7 +92,7 @@ class TagControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(TagRepositoryInterface::class); $repository = $this->mock(TagRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('destroy'); $repository->shouldReceive('destroy');
$this->be($this->user()); $this->be($this->user());
@@ -109,7 +109,7 @@ class TagControllerTest extends TestCase
// mock stuff // mock stuff
$tagRepos = $this->mock(TagRepositoryInterface::class); $tagRepos = $this->mock(TagRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('tags.edit', [1])); $response = $this->get(route('tags.edit', [1]));
@@ -126,7 +126,7 @@ class TagControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(TagRepositoryInterface::class); $repository = $this->mock(TagRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('count')->andReturn(0); $repository->shouldReceive('count')->andReturn(0);
$repository->shouldReceive('tagCloud')->andReturn([]); $repository->shouldReceive('tagCloud')->andReturn([]);
$repository->shouldReceive('oldestTag')->andReturn(null)->once(); $repository->shouldReceive('oldestTag')->andReturn(null)->once();
@@ -153,7 +153,7 @@ class TagControllerTest extends TestCase
$repository = $this->mock(TagRepositoryInterface::class); $repository = $this->mock(TagRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('spentInPeriod')->andReturn('-1')->once(); $repository->shouldReceive('spentInPeriod')->andReturn('-1')->once();
$repository->shouldReceive('firstUseDate')->andReturn(new Carbon)->once(); $repository->shouldReceive('firstUseDate')->andReturn(new Carbon)->once();
$repository->shouldReceive('lastUseDate')->andReturn(new Carbon)->once(); $repository->shouldReceive('lastUseDate')->andReturn(new Carbon)->once();
@@ -186,7 +186,7 @@ class TagControllerTest extends TestCase
$repository = $this->mock(TagRepositoryInterface::class); $repository = $this->mock(TagRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('firstUseDate')->andReturn(new Carbon)->once(); $repository->shouldReceive('firstUseDate')->andReturn(new Carbon)->once();
$collector->shouldReceive('removeFilter')->andReturnSelf()->once(); $collector->shouldReceive('removeFilter')->andReturnSelf()->once();
@@ -222,7 +222,7 @@ class TagControllerTest extends TestCase
$repository = $this->mock(TagRepositoryInterface::class); $repository = $this->mock(TagRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('spentInPeriod')->andReturn('-1')->once(); $repository->shouldReceive('spentInPeriod')->andReturn('-1')->once();
$repository->shouldReceive('firstUseDate')->andReturn(new Carbon)->once(); $repository->shouldReceive('firstUseDate')->andReturn(new Carbon)->once();
$repository->shouldReceive('lastUseDate')->andReturn(new Carbon)->once(); $repository->shouldReceive('lastUseDate')->andReturn(new Carbon)->once();
@@ -261,7 +261,7 @@ class TagControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(TagRepositoryInterface::class); $repository = $this->mock(TagRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('find')->andReturn(new Tag); $repository->shouldReceive('find')->andReturn(new Tag);
$repository->shouldReceive('store')->andReturn(new Tag); $repository->shouldReceive('store')->andReturn(new Tag);
@@ -287,7 +287,7 @@ class TagControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(TagRepositoryInterface::class); $repository = $this->mock(TagRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->session(['tags.edit.uri' => 'http://localhost']); $this->session(['tags.edit.uri' => 'http://localhost']);
$data = [ $data = [

View File

@@ -45,7 +45,7 @@ class BulkControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -61,7 +61,7 @@ class BulkControllerTest extends TestCase
$budgetRepos->shouldReceive('getActiveBudgets')->andReturn(new Collection); $budgetRepos->shouldReceive('getActiveBudgets')->andReturn(new Collection);
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection);
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection); $journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getTransactionType')->andReturn('Transfer'); $journalRepos->shouldReceive('getTransactionType')->andReturn('Transfer');
$journalRepos->shouldReceive('isJournalReconciled')->andReturn(false); $journalRepos->shouldReceive('isJournalReconciled')->andReturn(false);
@@ -84,7 +84,7 @@ class BulkControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$budgetRepos = $this->mock(BudgetRepositoryInterface::class); $budgetRepos = $this->mock(BudgetRepositoryInterface::class);
$budgetRepos->shouldReceive('getActiveBudgets')->andReturn(new Collection); $budgetRepos->shouldReceive('getActiveBudgets')->andReturn(new Collection);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getJournalSourceAccounts') $journalRepos->shouldReceive('getJournalSourceAccounts')
->andReturn(new Collection([1, 2, 3]), new Collection, new Collection, new Collection, new Collection([1])); ->andReturn(new Collection([1, 2, 3]), new Collection, new Collection, new Collection, new Collection([1]));
$journalRepos->shouldReceive('getJournalDestinationAccounts') $journalRepos->shouldReceive('getJournalDestinationAccounts')
@@ -128,7 +128,7 @@ class BulkControllerTest extends TestCase
]; ];
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('findNull')->times(4)->andReturn(new TransactionJournal); $repository->shouldReceive('findNull')->times(4)->andReturn(new TransactionJournal);
$repository->shouldReceive('updateCategory')->times(4)->andReturn(new TransactionJournal()) $repository->shouldReceive('updateCategory')->times(4)->andReturn(new TransactionJournal())

View File

@@ -51,7 +51,7 @@ class ConvertControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -64,7 +64,7 @@ class ConvertControllerTest extends TestCase
// mock stuff: // mock stuff:
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once(); $journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once(); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once();
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once(); $journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once();
@@ -96,7 +96,7 @@ class ConvertControllerTest extends TestCase
{ {
// mock stuff: // mock stuff:
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once(); $journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once(); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once();
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once(); $journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once();
@@ -121,7 +121,7 @@ class ConvertControllerTest extends TestCase
{ {
// mock stuff: // mock stuff:
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once(); $journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();
$this->be($this->user()); $this->be($this->user());
@@ -138,7 +138,7 @@ class ConvertControllerTest extends TestCase
{ {
// mock stuff: // mock stuff:
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once(); $journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();
// mock stuff for new account list thing. // mock stuff for new account list thing.
@@ -167,7 +167,7 @@ class ConvertControllerTest extends TestCase
{ {
// mock stuff: // mock stuff:
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once(); $journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once(); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once();
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once(); $journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once();
@@ -187,7 +187,7 @@ class ConvertControllerTest extends TestCase
{ {
// mock stuff: // mock stuff:
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once(); $journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once(); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once();
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once(); $journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once();
@@ -211,7 +211,7 @@ class ConvertControllerTest extends TestCase
{ {
// mock stuff: // mock stuff:
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once(); $journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once(); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once();
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once(); $journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once();
@@ -235,7 +235,7 @@ class ConvertControllerTest extends TestCase
{ {
// mock stuff: // mock stuff:
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once(); $journalRepos->shouldReceive('getJournalTotal')->andReturn('1')->once();
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once(); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection)->once();
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once(); $journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection)->once();
@@ -270,7 +270,7 @@ class ConvertControllerTest extends TestCase
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('convert')->andReturn(new MessageBag); $repository->shouldReceive('convert')->andReturn(new MessageBag);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('find')->andReturn(new Account); $accountRepos->shouldReceive('find')->andReturn(new Account);
@@ -299,7 +299,7 @@ class ConvertControllerTest extends TestCase
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('convert')->andReturn(new MessageBag); $repository->shouldReceive('convert')->andReturn(new MessageBag);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('store')->andReturn(new Account); $accountRepos->shouldReceive('store')->andReturn(new Account);
@@ -325,7 +325,7 @@ class ConvertControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('convert')->andReturn(new MessageBag); $repository->shouldReceive('convert')->andReturn(new MessageBag);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('getCashAccount')->andReturn(new Account)->once(); $accountRepos->shouldReceive('getCashAccount')->andReturn(new Account)->once();
@@ -359,7 +359,7 @@ class ConvertControllerTest extends TestCase
$messageBag->add('fake', 'fake error'); $messageBag->add('fake', 'fake error');
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('convert')->andReturn($messageBag); $repository->shouldReceive('convert')->andReturn($messageBag);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice(); $repository->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->twice();
$repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice(); $repository->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]))->twice();
@@ -387,7 +387,7 @@ class ConvertControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('convert')->andReturn(new MessageBag); $repository->shouldReceive('convert')->andReturn(new MessageBag);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first(); $withdrawal = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->first();
$data = [ $data = [
@@ -410,7 +410,7 @@ class ConvertControllerTest extends TestCase
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('convert')->andReturn(new MessageBag); $repository->shouldReceive('convert')->andReturn(new MessageBag);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$withdrawal = TransactionJournal::where('transaction_type_id', 1) $withdrawal = TransactionJournal::where('transaction_type_id', 1)
->whereNull('transaction_journals.deleted_at') ->whereNull('transaction_journals.deleted_at')
@@ -437,7 +437,7 @@ class ConvertControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('convert')->andReturn(new MessageBag); $repository->shouldReceive('convert')->andReturn(new MessageBag);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('store')->andReturn(new Account)->once(); $accountRepos->shouldReceive('store')->andReturn(new Account)->once();
@@ -464,7 +464,7 @@ class ConvertControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('convert')->andReturn(new MessageBag); $repository->shouldReceive('convert')->andReturn(new MessageBag);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('store')->andReturn(new Account)->once(); $accountRepos->shouldReceive('store')->andReturn(new Account)->once();
@@ -491,7 +491,7 @@ class ConvertControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('convert')->andReturn(new MessageBag); $repository->shouldReceive('convert')->andReturn(new MessageBag);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('getCashAccount')->andReturn(new Account)->once(); $accountRepos->shouldReceive('getCashAccount')->andReturn(new Account)->once();
@@ -518,7 +518,7 @@ class ConvertControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('convert')->andReturn(new MessageBag); $repository->shouldReceive('convert')->andReturn(new MessageBag);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos = $this->mock(AccountRepositoryInterface::class); $accountRepos = $this->mock(AccountRepositoryInterface::class);
$accountRepos->shouldReceive('findNull')->andReturn(new Account); $accountRepos->shouldReceive('findNull')->andReturn(new Account);

View File

@@ -41,7 +41,7 @@ class LinkControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -53,7 +53,7 @@ class LinkControllerTest extends TestCase
{ {
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$linkRepos = $this->mock(LinkTypeRepositoryInterface::class); $linkRepos = $this->mock(LinkTypeRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('transactions.link.delete', [1])); $response = $this->get(route('transactions.link.delete', [1]));
@@ -69,7 +69,7 @@ class LinkControllerTest extends TestCase
$repository = $this->mock(LinkTypeRepositoryInterface::class); $repository = $this->mock(LinkTypeRepositoryInterface::class);
$repository->shouldReceive('destroyLink'); $repository->shouldReceive('destroyLink');
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
@@ -94,7 +94,7 @@ class LinkControllerTest extends TestCase
'link_type' => '1_inward', 'link_type' => '1_inward',
]; ];
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('find')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('find')->andReturn(new TransactionJournal);
$repository->shouldReceive('findLink')->andReturn(false); $repository->shouldReceive('findLink')->andReturn(false);
$repository->shouldReceive('storeLink')->andReturn(new TransactionJournalLink); $repository->shouldReceive('storeLink')->andReturn(new TransactionJournalLink);
@@ -120,7 +120,7 @@ class LinkControllerTest extends TestCase
'link_type' => '1_inward', 'link_type' => '1_inward',
]; ];
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('find')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('find')->andReturn(new TransactionJournal);
$repository->shouldReceive('findLink')->andReturn(true); $repository->shouldReceive('findLink')->andReturn(true);
@@ -145,7 +145,7 @@ class LinkControllerTest extends TestCase
'link_type' => '1_inward', 'link_type' => '1_inward',
]; ];
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$response = $this->post(route('transactions.link.store', [1]), $data); $response = $this->post(route('transactions.link.store', [1]), $data);
@@ -161,7 +161,7 @@ class LinkControllerTest extends TestCase
{ {
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(LinkTypeRepositoryInterface::class); $repository = $this->mock(LinkTypeRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('switchLink')->andReturn(false); $repository->shouldReceive('switchLink')->andReturn(false);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('transactions.link.switch', [1])); $response = $this->get(route('transactions.link.switch', [1]));

View File

@@ -46,7 +46,7 @@ class MassControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -57,7 +57,7 @@ class MassControllerTest extends TestCase
public function testDelete() public function testDelete()
{ {
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$withdrawals = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->take(2)->get()->pluck('id')->toArray(); $withdrawals = TransactionJournal::where('transaction_type_id', 1)->where('user_id', $this->user()->id)->take(2)->get()->pluck('id')->toArray();
@@ -80,7 +80,7 @@ class MassControllerTest extends TestCase
// mock deletion: // mock deletion:
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('findNull')->andReturnValues([$deposits[0], $deposits[1]])->times(2); $repository->shouldReceive('findNull')->andReturnValues([$deposits[0], $deposits[1]])->times(2);
$repository->shouldReceive('destroy')->times(2); $repository->shouldReceive('destroy')->times(2);
@@ -106,7 +106,7 @@ class MassControllerTest extends TestCase
$transfersArray = $transfers->pluck('id')->toArray(); $transfersArray = $transfers->pluck('id')->toArray();
$source = $this->user()->accounts()->first(); $source = $this->user()->accounts()->first();
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
// mock data for edit page: // mock data for edit page:
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$source])); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$source]));
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$source])); $journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$source]));
@@ -141,14 +141,14 @@ class MassControllerTest extends TestCase
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection); $budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
// mock stuff: // mock stuff:
$repository = $this->mock(AccountRepositoryInterface::class); $repository = $this->mock(AccountRepositoryInterface::class);
$repository->shouldReceive('getAccountsByType')->once()->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection); $repository->shouldReceive('getAccountsByType')->once()->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getJournalSourceAccounts') $journalRepos->shouldReceive('getJournalSourceAccounts')
->andReturn(new Collection([1, 2, 3]), new Collection, new Collection, new Collection, new Collection([1])); ->andReturn(new Collection([1, 2, 3]), new Collection, new Collection, new Collection, new Collection([1]));
$journalRepos->shouldReceive('getJournalDestinationAccounts') $journalRepos->shouldReceive('getJournalDestinationAccounts')
@@ -186,7 +186,7 @@ class MassControllerTest extends TestCase
// mock stuff // mock stuff
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('update')->once(); $repository->shouldReceive('update')->once();
$repository->shouldReceive('find')->once()->andReturn($deposit); $repository->shouldReceive('find')->once()->andReturn($deposit);
$repository->shouldReceive('getTransactionType')->andReturn('Deposit'); $repository->shouldReceive('getTransactionType')->andReturn('Deposit');

View File

@@ -62,7 +62,7 @@ class SingleControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -77,7 +77,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$account = $this->user()->accounts()->first(); $account = $this->user()->accounts()->first();
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account])); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]));
@@ -110,7 +110,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
Steam::shouldReceive('phpBytes')->andReturn(2048); Steam::shouldReceive('phpBytes')->andReturn(2048);
$budgetRepos->shouldReceive('getActiveBudgets')->andReturn(new Collection)->once(); $budgetRepos->shouldReceive('getActiveBudgets')->andReturn(new Collection)->once();
@@ -136,7 +136,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
Steam::shouldReceive('phpBytes')->andReturn(2048); Steam::shouldReceive('phpBytes')->andReturn(2048);
$budgetRepos->shouldReceive('getActiveBudgets')->andReturn(new Collection)->once(); $budgetRepos->shouldReceive('getActiveBudgets')->andReturn(new Collection)->once();
@@ -161,7 +161,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
Steam::shouldReceive('phpBytes')->andReturn(2048); Steam::shouldReceive('phpBytes')->andReturn(2048);
$budgetRepos->shouldReceive('getActiveBudgets')->andReturn(new Collection)->once(); $budgetRepos->shouldReceive('getActiveBudgets')->andReturn(new Collection)->once();
@@ -185,7 +185,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$withdrawal = TransactionJournal::where('transaction_type_id', 1)->whereNull('deleted_at')->where('user_id', $this->user()->id)->first(); $withdrawal = TransactionJournal::where('transaction_type_id', 1)->whereNull('deleted_at')->where('user_id', $this->user()->id)->first();
@@ -207,7 +207,7 @@ class SingleControllerTest extends TestCase
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('destroy')->once(); $journalRepos->shouldReceive('destroy')->once();
$journalRepos->shouldReceive('getTransactionType')->once()->andReturn('Withdrawal'); $journalRepos->shouldReceive('getTransactionType')->once()->andReturn('Withdrawal');
@@ -232,11 +232,11 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$account = $this->user()->accounts()->first(); $account = $this->user()->accounts()->first();
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once(); $budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once();
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('countTransactions')->andReturn(2)->once(); $journalRepos->shouldReceive('countTransactions')->andReturn(2)->once();
$journalRepos->shouldReceive('getTransactionType')->andReturn('Withdrawal')->once(); $journalRepos->shouldReceive('getTransactionType')->andReturn('Withdrawal')->once();
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->once(); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->once();
@@ -274,7 +274,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once(); $budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once();
@@ -320,7 +320,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once(); $budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once();
@@ -367,7 +367,7 @@ class SingleControllerTest extends TestCase
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('getTransactionType')->andReturn('Reconciliation')->once(); $journalRepos->shouldReceive('getTransactionType')->andReturn('Reconciliation')->once();
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$reconcile = TransactionJournal::where('transaction_type_id', 5) $reconcile = TransactionJournal::where('transaction_type_id', 5)
@@ -392,7 +392,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$withdrawal = TransactionJournal::where('transaction_type_id', 1) $withdrawal = TransactionJournal::where('transaction_type_id', 1)
@@ -421,7 +421,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$this->be($this->user()); $this->be($this->user());
$journalRepos->shouldReceive('getTransactionType')->andReturn('Opening balance'); $journalRepos->shouldReceive('getTransactionType')->andReturn('Opening balance');
@@ -441,7 +441,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once(); $budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once();
@@ -489,7 +489,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$account = $this->user()->accounts()->first(); $account = $this->user()->accounts()->first();
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once(); $budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once();
@@ -498,7 +498,7 @@ class SingleControllerTest extends TestCase
$transaction->foreign_amount = '1'; $transaction->foreign_amount = '1';
$transaction->foreign_currency_id = 2; $transaction->foreign_currency_id = 2;
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('countTransactions')->andReturn(2)->once(); $journalRepos->shouldReceive('countTransactions')->andReturn(2)->once();
$journalRepos->shouldReceive('getTransactionType')->andReturn('Withdrawal')->once(); $journalRepos->shouldReceive('getTransactionType')->andReturn('Withdrawal')->once();
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->once(); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]))->once();
@@ -530,7 +530,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once(); $budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection)->once();
@@ -579,7 +579,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
// mock results: // mock results:
$journal = new TransactionJournal(); $journal = new TransactionJournal();
@@ -615,7 +615,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
// mock results: // mock results:
$journal = new TransactionJournal(); $journal = new TransactionJournal();
@@ -667,7 +667,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
// mock results: // mock results:
$journal = new TransactionJournal(); $journal = new TransactionJournal();
@@ -719,7 +719,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
// mock results: // mock results:
$journal = new TransactionJournal(); $journal = new TransactionJournal();
@@ -771,7 +771,7 @@ class SingleControllerTest extends TestCase
$attRepos = $this->mock(AttachmentHelperInterface::class); $attRepos = $this->mock(AttachmentHelperInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class); $currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
// mock results: // mock results:
$journal = new TransactionJournal(); $journal = new TransactionJournal();
@@ -826,7 +826,7 @@ class SingleControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$linkRepos = $this->mock(LinkTypeRepositoryInterface::class); $linkRepos = $this->mock(LinkTypeRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getTransactionType')->andReturn('Withdrawal'); $journalRepos->shouldReceive('getTransactionType')->andReturn('Withdrawal');
$journalRepos->shouldReceive('getPiggyBankEvents')->andReturn(new Collection); $journalRepos->shouldReceive('getPiggyBankEvents')->andReturn(new Collection);
$journalRepos->shouldReceive('getMetaField')->andReturn(''); $journalRepos->shouldReceive('getMetaField')->andReturn('');

View File

@@ -54,7 +54,7 @@ class SplitControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -85,7 +85,7 @@ class SplitControllerTest extends TestCase
$array = $transactions->toArray(); $array = $transactions->toArray();
$array[0]['category'] = ''; $array[0]['category'] = '';
$journalRepos->shouldReceive('first')->once()->andReturn($deposit); $journalRepos->shouldReceive('firstNull')->once()->andReturn($deposit);
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account])); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]));
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account])); $journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]));
$journalRepos->shouldReceive('getTransactionType')->once()->andReturn('Deposit'); $journalRepos->shouldReceive('getTransactionType')->once()->andReturn('Deposit');
@@ -143,7 +143,7 @@ class SplitControllerTest extends TestCase
->withArgs([[AccountType::ASSET, AccountType::DEFAULT]])->andReturn(new Collection([$account]))->twice(); ->withArgs([[AccountType::ASSET, AccountType::DEFAULT]])->andReturn(new Collection([$account]))->twice();
$journalRepos->shouldReceive('first')->once()->andReturn($deposit); $journalRepos->shouldReceive('firstNull')->once()->andReturn($deposit);
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account])); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]));
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account])); $journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]));
$journalRepos->shouldReceive('getTransactionType')->once()->andReturn('Deposit'); $journalRepos->shouldReceive('getTransactionType')->once()->andReturn('Deposit');
@@ -227,7 +227,7 @@ class SplitControllerTest extends TestCase
$attHelper = $this->mock(AttachmentHelperInterface::class); $attHelper = $this->mock(AttachmentHelperInterface::class);
$opening = TransactionJournal::where('transaction_type_id', 4)->where('user_id', $this->user()->id)->first(); $opening = TransactionJournal::where('transaction_type_id', 4)->where('user_id', $this->user()->id)->first();
$journalRepos->shouldReceive('first')->once()->andReturn($opening); $journalRepos->shouldReceive('firstNull')->once()->andReturn($opening);
$this->be($this->user()); $this->be($this->user());
$response = $this->get(route('transactions.split.edit', [$opening->id])); $response = $this->get(route('transactions.split.edit', [$opening->id]));
$response->assertStatus(302); $response->assertStatus(302);
@@ -257,7 +257,7 @@ class SplitControllerTest extends TestCase
$currencyRepository->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::find(1)); $currencyRepository->shouldReceive('findNull')->withArgs([1])->andReturn(TransactionCurrency::find(1));
$journalRepos->shouldReceive('first')->once()->andReturn($deposit); $journalRepos->shouldReceive('firstNull')->once()->andReturn($deposit);
$journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account])); $journalRepos->shouldReceive('getJournalSourceAccounts')->andReturn(new Collection([$account]));
$journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account])); $journalRepos->shouldReceive('getJournalDestinationAccounts')->andReturn(new Collection([$account]));
$journalRepos->shouldReceive('getTransactionType')->once()->andReturn('Deposit'); $journalRepos->shouldReceive('getTransactionType')->once()->andReturn('Deposit');
@@ -323,7 +323,7 @@ class SplitControllerTest extends TestCase
// mock stuff // mock stuff
$journalRepos->shouldReceive('update')->andReturn($deposit); $journalRepos->shouldReceive('update')->andReturn($deposit);
$journalRepos->shouldReceive('first')->andReturn($deposit); $journalRepos->shouldReceive('firstNull')->andReturn($deposit);
$journalRepos->shouldReceive('getTransactionType')->andReturn('Deposit'); $journalRepos->shouldReceive('getTransactionType')->andReturn('Deposit');
$attHelper->shouldReceive('saveAttachmentsForModel'); $attHelper->shouldReceive('saveAttachmentsForModel');
@@ -371,7 +371,7 @@ class SplitControllerTest extends TestCase
], ],
]; ];
$journalRepos->shouldReceive('first')->once()->andReturn($opening); $journalRepos->shouldReceive('firstNull')->once()->andReturn($opening);
$this->be($this->user()); $this->be($this->user());
$response = $this->post(route('transactions.split.update', [$opening->id]), $data); $response = $this->post(route('transactions.split.update', [$opening->id]), $data);
@@ -422,7 +422,7 @@ class SplitControllerTest extends TestCase
// mock stuff // mock stuff
$journalRepos->shouldReceive('update')->andReturn($transfer); $journalRepos->shouldReceive('update')->andReturn($transfer);
$journalRepos->shouldReceive('first')->andReturn($transfer); $journalRepos->shouldReceive('firstNull')->andReturn($transfer);
$journalRepos->shouldReceive('getTransactionType')->andReturn('Withdrawal'); $journalRepos->shouldReceive('getTransactionType')->andReturn('Withdrawal');
$attHelper->shouldReceive('saveAttachmentsForModel'); $attHelper->shouldReceive('saveAttachmentsForModel');
@@ -478,7 +478,7 @@ class SplitControllerTest extends TestCase
// mock stuff // mock stuff
$journalRepos->shouldReceive('update')->andReturn($withdrawal); $journalRepos->shouldReceive('update')->andReturn($withdrawal);
$journalRepos->shouldReceive('first')->andReturn($withdrawal); $journalRepos->shouldReceive('firstNull')->andReturn($withdrawal);
$journalRepos->shouldReceive('getTransactionType')->andReturn('Withdrawal'); $journalRepos->shouldReceive('getTransactionType')->andReturn('Withdrawal');
$attHelper->shouldReceive('saveAttachmentsForModel'); $attHelper->shouldReceive('saveAttachmentsForModel');

View File

@@ -49,7 +49,7 @@ class TransactionControllerTest extends TestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this))); Log::debug(sprintf('Now in %s.', \get_class($this)));
} }
@@ -68,8 +68,7 @@ class TransactionControllerTest extends TestCase
$transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first(); $transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first();
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$repository->shouldReceive('first')->once()->andReturn($transfer); $repository->shouldReceive('firstNull')->twice()->andReturn($transfer);
$repository->shouldReceive('firstNull')->once()->andReturn($transfer);
$collector->shouldReceive('setTypes')->andReturnSelf(); $collector->shouldReceive('setTypes')->andReturnSelf();
$collector->shouldReceive('setLimit')->andReturnSelf(); $collector->shouldReceive('setLimit')->andReturnSelf();
@@ -103,7 +102,7 @@ class TransactionControllerTest extends TestCase
$transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first(); $transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first();
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$repository->shouldReceive('first')->twice()->andReturn($transfer); $repository->shouldReceive('firstNull')->twice()->andReturn($transfer);
$collector->shouldReceive('setTypes')->andReturnSelf(); $collector->shouldReceive('setTypes')->andReturnSelf();
$collector->shouldReceive('setLimit')->andReturnSelf(); $collector->shouldReceive('setLimit')->andReturnSelf();
@@ -146,7 +145,7 @@ class TransactionControllerTest extends TestCase
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first(); $transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first();
$repository->shouldReceive('firstNull')->once()->andReturn($transfer); $repository->shouldReceive('firstNull')->once()->andReturn($transfer);
$repository->shouldReceive('first')->once()->andReturn($transfer); $repository->shouldReceive('firstNull')->once()->andReturn($transfer);
$collector->shouldReceive('setTypes')->andReturnSelf(); $collector->shouldReceive('setTypes')->andReturnSelf();
$collector->shouldReceive('setLimit')->andReturnSelf(); $collector->shouldReceive('setLimit')->andReturnSelf();
@@ -188,7 +187,7 @@ class TransactionControllerTest extends TestCase
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first(); $transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first();
$repository->shouldReceive('first')->once()->andReturn($transfer); $repository->shouldReceive('firstNull')->once()->andReturn($transfer);
$repository->shouldReceive('firstNull')->once()->andReturn($transfer); $repository->shouldReceive('firstNull')->once()->andReturn($transfer);
$collector->shouldReceive('setTypes')->andReturnSelf(); $collector->shouldReceive('setTypes')->andReturnSelf();
@@ -232,7 +231,7 @@ class TransactionControllerTest extends TestCase
$collector = $this->mock(JournalCollectorInterface::class); $collector = $this->mock(JournalCollectorInterface::class);
$transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first(); $transfer = $this->user()->transactionJournals()->inRandomOrder()->where('transaction_type_id', 3)->first();
$repository->shouldReceive('firstNull')->once()->andReturn($transfer); $repository->shouldReceive('firstNull')->once()->andReturn($transfer);
$repository->shouldReceive('first')->once()->andReturn($transfer); $repository->shouldReceive('firstNull')->once()->andReturn($transfer);
$collector->shouldReceive('setTypes')->andReturnSelf(); $collector->shouldReceive('setTypes')->andReturnSelf();
$collector->shouldReceive('setLimit')->andReturnSelf(); $collector->shouldReceive('setLimit')->andReturnSelf();
@@ -261,7 +260,7 @@ class TransactionControllerTest extends TestCase
{ {
$data = ['transactions' => [1, 2]]; $data = ['transactions' => [1, 2]];
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('first')->times(1)->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->times(1)->andReturn(new TransactionJournal);
$repository->shouldReceive('findTransaction')->andReturn(new Transaction)->twice(); $repository->shouldReceive('findTransaction')->andReturn(new Transaction)->twice();
$repository->shouldReceive('reconcile')->twice(); $repository->shouldReceive('reconcile')->twice();
@@ -280,7 +279,7 @@ class TransactionControllerTest extends TestCase
$journal = factory(TransactionJournal::class)->make(); $journal = factory(TransactionJournal::class)->make();
$journal->date = new Carbon('2016-01-01'); $journal->date = new Carbon('2016-01-01');
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('first')->once()->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('find')->once()->andReturn($journal); $repository->shouldReceive('find')->once()->andReturn($journal);
$repository->shouldReceive('setOrder')->once()->andReturn(true); $repository->shouldReceive('setOrder')->once()->andReturn(true);
@@ -307,7 +306,7 @@ class TransactionControllerTest extends TestCase
$journalRepos = $this->mock(JournalRepositoryInterface::class); $journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('getPiggyBankEvents')->andReturn(new Collection); $journalRepos->shouldReceive('getPiggyBankEvents')->andReturn(new Collection);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal); $journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('getMetaField')->andReturn(''); $journalRepos->shouldReceive('getMetaField')->andReturn('');
$this->be($this->user()); $this->be($this->user());

View File

@@ -50,7 +50,7 @@ abstract class TestCase extends BaseTestCase
public function changeDateRange(User $user, $range) public function changeDateRange(User $user, $range)
{ {
$valid = ['1D', '1W', '1M', '3M', '6M', '1Y', 'custom']; $valid = ['1D', '1W', '1M', '3M', '6M', '1Y', 'custom'];
if (in_array($range, $valid)) { if (\in_array($range, $valid)) {
try { try {
Preference::where('user_id', $user->id)->where('name', 'viewRange')->delete(); Preference::where('user_id', $user->id)->where('name', 'viewRange')->delete();
} catch (Exception $e) { } catch (Exception $e) {
@@ -150,6 +150,6 @@ abstract class TestCase extends BaseTestCase
{ {
parent::setUp(); parent::setUp();
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('first')->andReturn(new TransactionJournal); $repository->shouldReceive('firstNull')->andReturn(new TransactionJournal);
} }
} }

View File

@@ -26,6 +26,7 @@ namespace Tests\Unit\Factory;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Factory\AccountFactory; use FireflyIII\Factory\AccountFactory;
use FireflyIII\Models\AccountMeta;
use FireflyIII\Models\AccountType; use FireflyIII\Models\AccountType;
use Tests\TestCase; use Tests\TestCase;
@@ -65,7 +66,12 @@ class AccountFactoryTest extends TestCase
$this->assertEquals('', $account->iban); $this->assertEquals('', $account->iban);
$this->assertTrue($account->active); $this->assertTrue($account->active);
$this->assertEquals('0', $account->virtual_balance); $this->assertEquals('0', $account->virtual_balance);
$this->assertEquals('defaultAsset', $account->getMeta('accountRole'));
// get the role:
/** @var AccountMeta $meta */
$meta = $account->accountMeta()->where('name','accountRole')->first();
$this->assertNotNull($meta);
$this->assertEquals('defaultAsset', $meta->data);
} }
/** /**
@@ -99,7 +105,12 @@ class AccountFactoryTest extends TestCase
$this->assertEquals('', $account->iban); $this->assertEquals('', $account->iban);
$this->assertTrue($account->active); $this->assertTrue($account->active);
$this->assertEquals('0', $account->virtual_balance); $this->assertEquals('0', $account->virtual_balance);
$this->assertEquals('defaultAsset', $account->getMeta('accountRole'));
// get the role:
/** @var AccountMeta $meta */
$meta = $account->accountMeta()->where('name','accountRole')->first();
$this->assertNotNull($meta);
$this->assertEquals('defaultAsset', $meta->data);
} }
/** /**
@@ -134,8 +145,18 @@ class AccountFactoryTest extends TestCase
$this->assertEquals('', $account->iban); $this->assertEquals('', $account->iban);
$this->assertTrue($account->active); $this->assertTrue($account->active);
$this->assertEquals('0', $account->virtual_balance); $this->assertEquals('0', $account->virtual_balance);
$this->assertEquals('ccAsset', $account->getMeta('accountRole'));
$this->assertEquals('2018-01-01', $account->getMeta('ccMonthlyPaymentDate')); // get the role:
/** @var AccountMeta $meta */
$meta = $account->accountMeta()->where('name','accountRole')->first();
$this->assertNotNull($meta);
$this->assertEquals('ccAsset', $meta->data);
// get the date:
/** @var AccountMeta $meta */
$meta = $account->accountMeta()->where('name','ccMonthlyPaymentDate')->first();
$this->assertNotNull($meta);
$this->assertEquals('2018-01-01', $meta->data);
} }
/** /**
@@ -170,7 +191,11 @@ class AccountFactoryTest extends TestCase
$this->assertEquals('', $account->iban); $this->assertEquals('', $account->iban);
$this->assertTrue($account->active); $this->assertTrue($account->active);
$this->assertEquals('0', $account->virtual_balance); $this->assertEquals('0', $account->virtual_balance);
$this->assertEquals('', $account->getMeta('accountRole'));
// get the role:
/** @var AccountMeta $meta */
$meta = $account->accountMeta()->where('name','accountRole')->first();
$this->assertNull($meta);
} }
/** /**
@@ -205,7 +230,11 @@ class AccountFactoryTest extends TestCase
$this->assertEquals('', $account->iban); $this->assertEquals('', $account->iban);
$this->assertTrue($account->active); $this->assertTrue($account->active);
$this->assertEquals('0', $account->virtual_balance); $this->assertEquals('0', $account->virtual_balance);
$this->assertEquals('', $account->getMeta('accountRole'));
// get the role:
/** @var AccountMeta $meta */
$meta = $account->accountMeta()->where('name','accountRole')->first();
$this->assertNull($meta);
} }
/** /**
@@ -242,7 +271,12 @@ class AccountFactoryTest extends TestCase
$this->assertEquals('', $account->iban); $this->assertEquals('', $account->iban);
$this->assertTrue($account->active); $this->assertTrue($account->active);
$this->assertEquals('0', $account->virtual_balance); $this->assertEquals('0', $account->virtual_balance);
$this->assertEquals('defaultAsset', $account->getMeta('accountRole'));
// get the role:
/** @var AccountMeta $meta */
$meta = $account->accountMeta()->where('name','accountRole')->first();
$this->assertNotNull($meta);
$this->assertEquals('defaultAsset', $meta->data);
// find opening balance: // find opening balance:
$this->assertEquals(1, $account->transactions()->count()); $this->assertEquals(1, $account->transactions()->count());
@@ -283,7 +317,12 @@ class AccountFactoryTest extends TestCase
$this->assertEquals('', $account->iban); $this->assertEquals('', $account->iban);
$this->assertTrue($account->active); $this->assertTrue($account->active);
$this->assertEquals('0', $account->virtual_balance); $this->assertEquals('0', $account->virtual_balance);
$this->assertEquals('defaultAsset', $account->getMeta('accountRole'));
// get the role:
/** @var AccountMeta $meta */
$meta = $account->accountMeta()->where('name','accountRole')->first();
$this->assertNotNull($meta);
$this->assertEquals('defaultAsset', $meta->data);
// find opening balance: // find opening balance:
$this->assertEquals(0, $account->transactions()->count()); $this->assertEquals(0, $account->transactions()->count());
@@ -320,7 +359,12 @@ class AccountFactoryTest extends TestCase
$this->assertEquals('NL18RABO0326747238', $account->iban); $this->assertEquals('NL18RABO0326747238', $account->iban);
$this->assertTrue($account->active); $this->assertTrue($account->active);
$this->assertEquals('0', $account->virtual_balance); $this->assertEquals('0', $account->virtual_balance);
$this->assertEquals('defaultAsset', $account->getMeta('accountRole'));
// get the role:
/** @var AccountMeta $meta */
$meta = $account->accountMeta()->where('name','accountRole')->first();
$this->assertNotNull($meta);
$this->assertEquals('defaultAsset', $meta->data);
} }
/** /**
@@ -354,7 +398,12 @@ class AccountFactoryTest extends TestCase
$this->assertEquals('', $account->iban); $this->assertEquals('', $account->iban);
$this->assertTrue($account->active); $this->assertTrue($account->active);
$this->assertEquals('0', $account->virtual_balance); $this->assertEquals('0', $account->virtual_balance);
$this->assertEquals('defaultAsset', $account->getMeta('accountRole'));
// get the role:
/** @var AccountMeta $meta */
$meta = $account->accountMeta()->where('name','accountRole')->first();
$this->assertNotNull($meta);
$this->assertEquals('defaultAsset', $meta->data);
} }
/** /**
@@ -391,7 +440,12 @@ class AccountFactoryTest extends TestCase
$this->assertEquals('', $account->iban); $this->assertEquals('', $account->iban);
$this->assertTrue($account->active); $this->assertTrue($account->active);
$this->assertEquals('0', $account->virtual_balance); $this->assertEquals('0', $account->virtual_balance);
$this->assertEquals('defaultAsset', $account->getMeta('accountRole'));
// get the role:
/** @var AccountMeta $meta */
$meta = $account->accountMeta()->where('name','accountRole')->first();
$this->assertNotNull($meta);
$this->assertEquals('defaultAsset', $meta->data);
// find opening balance: // find opening balance:
$this->assertEquals(1, $account->transactions()->count()); $this->assertEquals(1, $account->transactions()->count());
@@ -430,7 +484,13 @@ class AccountFactoryTest extends TestCase
$this->assertEquals('', $account->iban); $this->assertEquals('', $account->iban);
$this->assertTrue($account->active); $this->assertTrue($account->active);
$this->assertEquals('0', $account->virtual_balance); $this->assertEquals('0', $account->virtual_balance);
$this->assertEquals('defaultAsset', $account->getMeta('accountRole'));
// get the role:
/** @var AccountMeta $meta */
$meta = $account->accountMeta()->where('name','accountRole')->first();
$this->assertNotNull($meta);
$this->assertEquals('defaultAsset', $meta->data);
$note = $account->notes()->first(); $note = $account->notes()->first();
$this->assertEquals('Hello!', $note->text); $this->assertEquals('Hello!', $note->text);
} }

View File

@@ -41,7 +41,7 @@ class RangeTest extends TestCase
public function testMiddlewareAuthenticated() public function testMiddlewareAuthenticated()
{ {
$repository = $this->mock(JournalRepositoryInterface::class); $repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('first')->andReturn(TransactionJournal::first()); $repository->shouldReceive('firstNull')->andReturn(TransactionJournal::first());
$this->withoutExceptionHandling(); $this->withoutExceptionHandling();
$this->be($this->user()); $this->be($this->user());
$response = $this->get('/_test/range'); $response = $this->get('/_test/range');

View File

@@ -38,7 +38,7 @@ class SandstormTest extends TestCase
/** /**
* @covers \FireflyIII\Http\Middleware\Sandstorm::handle * @covers \FireflyIII\Http\Middleware\Sandstorm::handle
*/ */
public function testMiddlewareAnonEmpty() public function testMiddlewareAnonEmpty(): void
{ {
putenv('SANDSTORM=1'); putenv('SANDSTORM=1');
@@ -55,7 +55,7 @@ class SandstormTest extends TestCase
/** /**
* @covers \FireflyIII\Http\Middleware\Sandstorm::handle * @covers \FireflyIII\Http\Middleware\Sandstorm::handle
*/ */
public function testMiddlewareAnonLoggedIn() public function testMiddlewareAnonLoggedIn(): void
{ {
putenv('SANDSTORM=1'); putenv('SANDSTORM=1');
@@ -70,7 +70,7 @@ class SandstormTest extends TestCase
/** /**
* @covers \FireflyIII\Http\Middleware\Sandstorm::handle * @covers \FireflyIII\Http\Middleware\Sandstorm::handle
*/ */
public function testMiddlewareAnonUser() public function testMiddlewareAnonUser(): void
{ {
putenv('SANDSTORM=1'); putenv('SANDSTORM=1');
@@ -87,7 +87,7 @@ class SandstormTest extends TestCase
/** /**
* @covers \FireflyIII\Http\Middleware\Sandstorm::handle * @covers \FireflyIII\Http\Middleware\Sandstorm::handle
*/ */
public function testMiddlewareLoggedIn() public function testMiddlewareLoggedIn(): void
{ {
putenv('SANDSTORM=1'); putenv('SANDSTORM=1');
@@ -102,7 +102,7 @@ class SandstormTest extends TestCase
/** /**
* @covers \FireflyIII\Http\Middleware\Sandstorm::handle * @covers \FireflyIII\Http\Middleware\Sandstorm::handle
*/ */
public function testMiddlewareMultiUser() public function testMiddlewareMultiUser(): void
{ {
putenv('SANDSTORM=1'); putenv('SANDSTORM=1');
@@ -119,7 +119,7 @@ class SandstormTest extends TestCase
/** /**
* @covers \FireflyIII\Http\Middleware\Sandstorm::handle * @covers \FireflyIII\Http\Middleware\Sandstorm::handle
*/ */
public function testMiddlewareNoUser() public function testMiddlewareNoUser(): void
{ {
putenv('SANDSTORM=1'); putenv('SANDSTORM=1');
@@ -139,7 +139,7 @@ class SandstormTest extends TestCase
/** /**
* @covers \FireflyIII\Http\Middleware\Sandstorm::handle * @covers \FireflyIII\Http\Middleware\Sandstorm::handle
*/ */
public function testMiddlewareNotSandstorm() public function testMiddlewareNotSandstorm(): void
{ {
$this->withoutExceptionHandling(); $this->withoutExceptionHandling();
$response = $this->get('/_test/sandstorm'); $response = $this->get('/_test/sandstorm');
@@ -149,7 +149,7 @@ class SandstormTest extends TestCase
/** /**
* @covers \FireflyIII\Http\Middleware\Sandstorm::handle * @covers \FireflyIII\Http\Middleware\Sandstorm::handle
*/ */
public function testMiddlewareOneUser() public function testMiddlewareOneUser(): void
{ {
putenv('SANDSTORM=1'); putenv('SANDSTORM=1');
@@ -167,7 +167,7 @@ class SandstormTest extends TestCase
/** /**
* Set up test * Set up test
*/ */
protected function setUp() protected function setUp(): void
{ {
parent::setUp(); parent::setUp();