Fix tests for current feature set.

This commit is contained in:
James Cole
2018-10-27 05:39:11 +02:00
parent 970cc91938
commit c0ab0b5af5
3 changed files with 47 additions and 19 deletions

View File

@@ -57,14 +57,22 @@ class ReconcileControllerTest extends TestCase
*/
public function testOverview(): void
{
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$transactions = $this->user()->transactions()->inRandomOrder()->take(3)->get();
$repository = $this->mock(JournalRepositoryInterface::class);
$transactions = $this->user()->transactions()->inRandomOrder()->take(3)->get();
$transactions =$transactions->each(
function (Transaction $transaction) {
$transaction->transaction_amount = '5';
}
);
$repository = $this->mock(JournalRepositoryInterface::class);
$repository->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$repository->shouldReceive('getTransactionsById')->andReturn($transactions)->twice();
$accountRepos->shouldReceive('findNull')->andReturn($this->getRandomAsset())->atLeast()->once();
$accountRepos->shouldReceive('getMetaValue')->atLeast()->once()->andReturn(1);
$parameters = [
'startBalance' => '0',
'endBalance' => '10',
@@ -83,8 +91,8 @@ class ReconcileControllerTest extends TestCase
*/
public function testOverviewNotAsset(): void
{
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$account = $this->user()->accounts()->where('account_type_id', '!=', 3)->first();
@@ -107,8 +115,8 @@ class ReconcileControllerTest extends TestCase
*/
public function testTransactions(): void
{
$repository = $this->mock(CurrencyRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$repository = $this->mock(CurrencyRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->andReturn('1')->atLeast()->once();
@@ -125,8 +133,8 @@ class ReconcileControllerTest extends TestCase
*/
public function testTransactionsInitialBalance(): void
{
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$currencyRepos = $this->mock(CurrencyRepositoryInterface::class);
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);