Files
firefly-iii/tests/Unit/Jobs/CreateRecurringTransactionsTest.php

589 lines
22 KiB
PHP
Raw Normal View History

2019-07-27 13:54:06 +02:00
<?php
2019-08-17 12:09:03 +02:00
declare(strict_types=1);
2019-07-27 13:54:06 +02:00
/**
* CreateRecurringTransactionsTest.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
*
* This file is part of Firefly III.
*
* Firefly III is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Firefly III is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Tests\Unit\Jobs;
use Carbon\Carbon;
use FireflyIII\Events\StoredTransactionGroup;
use FireflyIII\Factory\PiggyBankEventFactory;
use FireflyIII\Factory\PiggyBankFactory;
use FireflyIII\Jobs\CreateRecurringTransactions;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
2019-08-29 17:53:25 +02:00
use FireflyIII\Repositories\User\UserRepositoryInterface;
2019-07-27 13:54:06 +02:00
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Event;
use Log;
use Preferences;
use Tests\TestCase;
/**
* Class CreateRecurringTransactionsTest
2019-08-17 10:48:28 +02:00
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
2019-07-27 13:54:06 +02:00
*/
class CreateRecurringTransactionsTest extends TestCase
{
/**
*
*/
public function setUp(): void
{
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
2019-08-29 17:53:25 +02:00
/**
* Submit one, offer occurence for today.
*
* @covers \FireflyIII\Jobs\CreateRecurringTransactions
*/
public function testBadJournalCount(): void
{
Event::fake();
$date = new Carbon();
// overrule some fields in the recurrence to make it seem it hasnt fired yet.
$carbon = new Carbon;
$carbon->subDays(4);
$recurrence = $this->getRandomRecurrence();
$recurrence->latest_date = null;
$recurrence->first_date = $carbon;
$recurrence->save();
// mock classes
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$groupRepos = $this->mock(TransactionGroupRepositoryInterface::class);
$piggyFactory = $this->mock(PiggyBankFactory::class);
$piggyEventFactory = $this->mock(PiggyBankEventFactory::class);
// mocks:
$groupRepos->shouldReceive('setUser')->atLeast()->once();
$journalRepos->shouldReceive('setUser')->atLeast()->once();
$recurringRepos->shouldReceive('setUser')->atLeast()->once();
$recurringRepos->shouldReceive('getOccurrencesInRange')->atLeast()->once()->andReturn([$date]);
$recurringRepos->shouldReceive('getAll')->atLeast()->once()->andReturn(new Collection([$recurrence]));
$recurringRepos->shouldReceive('getJournalCount')->atLeast()->once()->andReturn(3);
Preferences::shouldReceive('mark')->atLeast()->once();
$job = new CreateRecurringTransactions($date);
$job->handle();
$this->assertEquals(0, $job->created);
$this->assertEquals(1, $job->executed);
$this->assertEquals(1, $job->submitted);
}
2019-07-27 13:54:06 +02:00
/**
* Submit nothing.
*
* @covers \FireflyIII\Jobs\CreateRecurringTransactions
*/
public function testBasic(): void
{
// mock classes
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$this->mock(JournalRepositoryInterface::class);
$this->mock(TransactionGroupRepositoryInterface::class);
// mocks:
$recurringRepos->shouldReceive('getAll')->atLeast()->once()->andReturn(new Collection);
Preferences::shouldReceive('mark')->atLeast()->once();
$date = new Carbon();
$job = new CreateRecurringTransactions($date);
$job->setForce(false);
$job->handle();
$this->assertEquals(0, $job->created);
$this->assertEquals(0, $job->executed);
$this->assertEquals(0, $job->submitted);
}
2019-08-29 17:53:25 +02:00
/**
* Submit one, offer occurence for today.
*
* @covers \FireflyIII\Jobs\CreateRecurringTransactions
*/
public function testForced(): void
{
Log::info(sprintf('Now in test %s.', __METHOD__));
Event::fake();
$date = new Carbon();
$this->expectsEvents([StoredTransactionGroup::class]);
// overrule some fields in the recurrence.
$carbon = new Carbon;
$carbon->subDays(4);
$recurrence = $this->getRandomRecurrence();
$recurrence->latest_date = null;
$recurrence->first_date = $carbon;
$recurrence->save();
$group = $this->getRandomWithdrawalGroup();
// overrule some fields in the recurrence to make it seem it hasnt fired yet.
$recurrence->latest_date = null;
$recurrence->save();
// mock classes
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$groupRepos = $this->mock(TransactionGroupRepositoryInterface::class);
$piggyFactory = $this->mock(PiggyBankFactory::class);
$piggyEventFactory = $this->mock(PiggyBankEventFactory::class);
// mocks:
$groupRepos->shouldReceive('setUser')->atLeast()->once();
$journalRepos->shouldReceive('setUser')->atLeast()->once();
$recurringRepos->shouldReceive('setUser')->atLeast()->once();
$recurringRepos->shouldReceive('getOccurrencesInRange')->atLeast()->once()->andReturn([$date]);
$recurringRepos->shouldReceive('getAll')->atLeast()->once()->andReturn(new Collection([$recurrence]));
$recurringRepos->shouldReceive('getJournalCount')->atLeast()->once()->andReturn(3);
$recurringRepos->shouldReceive('getPiggyBank')->atLeast()->once()->andReturnNull();
Preferences::shouldReceive('mark')->atLeast()->once();
// return data:
$recurringRepos->shouldReceive('getBudget')->atLeast()->once()->andReturnNull();
$recurringRepos->shouldReceive('getCategory')->atLeast()->once()->andReturnNull();
$recurringRepos->shouldReceive('getTags')->atLeast()->once()->andReturn([]);
// store journal
$groupRepos->shouldReceive('store')->atLeast()->once()->andReturn($group);
//Event::assertDispatched(StoredTransactionGroup::class);
$job = new CreateRecurringTransactions($date);
$job->setForce(true);
$job->handle();
$this->assertEquals(1, $job->created);
$this->assertEquals(1, $job->executed);
$this->assertEquals(1, $job->submitted);
}
2019-07-27 13:54:06 +02:00
/**
* Submit one, but offer no occurrences.
*
2019-07-31 16:53:09 +02:00
* TODO there is a random element in this test that breaks the test.
*
2019-07-27 13:54:06 +02:00
* @covers \FireflyIII\Jobs\CreateRecurringTransactions
*/
public function testSingle(): void
{
2019-08-29 17:53:25 +02:00
Event::fake();
2019-07-31 16:53:09 +02:00
Log::info(sprintf('Now in test %s.', __METHOD__));
2019-07-27 13:54:06 +02:00
// mock classes
2019-07-31 16:53:09 +02:00
$date = new Carbon;
$date->subDays(4);
$recurrence = $this->getRandomRecurrence();
$recurrence->latest_date = null;
$recurrence->first_date = $date;
$recurrence->save();
Log::debug(sprintf('Test is going to use Recurrence #%d', $recurrence->id), $recurrence->toArray());
2019-07-27 13:54:06 +02:00
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$groupRepos = $this->mock(TransactionGroupRepositoryInterface::class);
2019-08-29 17:53:25 +02:00
$userRepos = $this->mock(UserRepositoryInterface::class);
2019-07-27 13:54:06 +02:00
// mocks:
$groupRepos->shouldReceive('setUser')->atLeast()->once();
$journalRepos->shouldReceive('setUser')->atLeast()->once();
$recurringRepos->shouldReceive('setUser')->atLeast()->once();
$recurringRepos->shouldReceive('getOccurrencesInRange')->atLeast()->once()->andReturn([]);
$recurringRepos->shouldReceive('getAll')->atLeast()->once()->andReturn(new Collection([$recurrence]));
$recurringRepos->shouldReceive('getJournalCount')->atLeast()->once()->andReturn(0);
Preferences::shouldReceive('mark')->atLeast()->once();
$date = new Carbon();
$job = new CreateRecurringTransactions($date);
$job->handle();
$this->assertEquals(0, $job->created);
$this->assertEquals(1, $job->executed);
$this->assertEquals(1, $job->submitted);
}
/**
* Submit one, but has already fired today
*
* @covers \FireflyIII\Jobs\CreateRecurringTransactions
*/
public function testSingleFiredToday(): void
{
2019-08-29 17:53:25 +02:00
Log::info(sprintf('Now in test %s.', __METHOD__));
2019-07-27 13:54:06 +02:00
// mock classes
2019-08-29 17:53:25 +02:00
$recurrence = $this->getRandomRecurrence();
2019-07-27 13:54:06 +02:00
$recurrence->latest_date = new Carbon;
$recurrence->save();
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$this->mock(JournalRepositoryInterface::class);
$this->mock(TransactionGroupRepositoryInterface::class);
// mocks:
$recurringRepos->shouldReceive('getAll')->atLeast()->once()->andReturn(new Collection([$recurrence]));
$recurringRepos->shouldReceive('getJournalCount')->atLeast()->once()->andReturn(0);
Preferences::shouldReceive('mark')->atLeast()->once();
$date = new Carbon();
$job = new CreateRecurringTransactions($date);
$job->handle();
$this->assertEquals(0, $job->created);
$this->assertEquals(0, $job->executed);
$this->assertEquals(1, $job->submitted);
2019-08-29 17:53:25 +02:00
$recurrence->latest_date = null;
2019-07-27 13:54:06 +02:00
$recurrence->save();
}
/**
* Submit one, but offer no occurrences.
*
* @covers \FireflyIII\Jobs\CreateRecurringTransactions
*/
public function testSingleFuture(): void
{
2019-08-29 17:53:25 +02:00
Log::info(sprintf('Now in test %s.', __METHOD__));
2019-07-27 13:54:06 +02:00
// mock classes
$future = new Carbon;
$future->addDays(4);
2019-08-29 17:53:25 +02:00
$recurrence = $this->getRandomRecurrence();
$recurrence->first_date = $future;
2019-07-27 13:54:06 +02:00
$recurrence->save();
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$this->mock(JournalRepositoryInterface::class);
$this->mock(TransactionGroupRepositoryInterface::class);
// mocks:
$recurringRepos->shouldReceive('getAll')->atLeast()->once()->andReturn(new Collection([$recurrence]));
$recurringRepos->shouldReceive('getJournalCount')->atLeast()->once()->andReturn(0);
Preferences::shouldReceive('mark')->atLeast()->once();
$date = new Carbon();
$job = new CreateRecurringTransactions($date);
$job->handle();
$this->assertEquals(0, $job->created);
$this->assertEquals(0, $job->executed);
$this->assertEquals(1, $job->submitted);
2019-08-29 17:53:25 +02:00
$recurrence->first_date = $date;
2019-07-27 13:54:06 +02:00
$recurrence->save();
}
/**
2019-08-29 17:53:25 +02:00
* Submit one, but it's inactive.
2019-07-27 13:54:06 +02:00
*
* @covers \FireflyIII\Jobs\CreateRecurringTransactions
*/
2019-08-29 17:53:25 +02:00
public function testSingleInactive(): void
2019-07-27 13:54:06 +02:00
{
2019-08-29 17:53:25 +02:00
Log::info(sprintf('Now in test %s.', __METHOD__));
2019-07-27 13:54:06 +02:00
// mock classes
2019-08-29 17:53:25 +02:00
$recurrence = $this->getRandomRecurrence();
2019-07-27 13:54:06 +02:00
2019-08-29 17:53:25 +02:00
$recurrence->active = false;
2019-07-27 13:54:06 +02:00
$recurrence->save();
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$this->mock(JournalRepositoryInterface::class);
$this->mock(TransactionGroupRepositoryInterface::class);
// mocks:
$recurringRepos->shouldReceive('getAll')->atLeast()->once()->andReturn(new Collection([$recurrence]));
Preferences::shouldReceive('mark')->atLeast()->once();
2019-08-29 17:53:25 +02:00
$date = new Carbon();
$job = new CreateRecurringTransactions($date);
2019-07-27 13:54:06 +02:00
$job->handle();
$this->assertEquals(0, $job->created);
$this->assertEquals(0, $job->executed);
$this->assertEquals(1, $job->submitted);
2019-08-29 17:53:25 +02:00
$recurrence->active = true;
2019-07-27 13:54:06 +02:00
$recurrence->save();
}
/**
* @covers \FireflyIII\Jobs\CreateRecurringTransactions
*/
2019-08-29 17:53:25 +02:00
public function testSingleNotToday(): void
2019-07-27 13:54:06 +02:00
{
2019-08-29 17:53:25 +02:00
Event::fake();
Log::info(sprintf('Now in test %s.', __METHOD__));
$date = new Carbon();
$tomorrow = new Carbon();
$tomorrow->addDays(2);
// overrule some fields in the recurrence to make it seem it hasnt fired yet.
$carbon = new Carbon;
$carbon->subDays(4);
2019-07-27 13:54:06 +02:00
$recurrence = $this->getRandomRecurrence();
2019-08-29 17:53:25 +02:00
$recurrence->latest_date = null;
$recurrence->first_date = $carbon;
2019-07-27 13:54:06 +02:00
$recurrence->save();
2019-08-29 17:53:25 +02:00
// mock classes
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$groupRepos = $this->mock(TransactionGroupRepositoryInterface::class);
$piggyFactory = $this->mock(PiggyBankFactory::class);
$piggyEventFactory = $this->mock(PiggyBankEventFactory::class);
2019-07-27 13:54:06 +02:00
// mocks:
2019-08-29 17:53:25 +02:00
$groupRepos->shouldReceive('setUser')->atLeast()->once();
$journalRepos->shouldReceive('setUser')->atLeast()->once();
$recurringRepos->shouldReceive('setUser')->atLeast()->once();
$recurringRepos->shouldReceive('getOccurrencesInRange')->atLeast()->once()->andReturn([$tomorrow]);
2019-07-27 13:54:06 +02:00
$recurringRepos->shouldReceive('getAll')->atLeast()->once()->andReturn(new Collection([$recurrence]));
2019-08-29 17:53:25 +02:00
$recurringRepos->shouldReceive('getJournalCount')->atLeast()->once()->andReturn(0);
2019-07-27 13:54:06 +02:00
Preferences::shouldReceive('mark')->atLeast()->once();
2019-08-29 17:53:25 +02:00
$job = new CreateRecurringTransactions($date);
2019-07-27 13:54:06 +02:00
$job->handle();
$this->assertEquals(0, $job->created);
2019-08-29 17:53:25 +02:00
$this->assertEquals(1, $job->executed);
2019-07-27 13:54:06 +02:00
$this->assertEquals(1, $job->submitted);
}
/**
2019-08-29 17:53:25 +02:00
* Submit one, but it has fired enough times already.
2019-07-27 13:54:06 +02:00
*
* @covers \FireflyIII\Jobs\CreateRecurringTransactions
*/
2019-08-29 17:53:25 +02:00
public function testSingleOccurrences(): void
2019-07-27 13:54:06 +02:00
{
2019-08-29 17:53:25 +02:00
Log::info(sprintf('Now in test %s.', __METHOD__));
2019-07-27 13:54:06 +02:00
// mock classes
2019-08-29 17:53:25 +02:00
$recurrence = $this->getRandomRecurrence();
$recurrence->repetitions = 1;
2019-07-27 13:54:06 +02:00
$recurrence->save();
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$this->mock(JournalRepositoryInterface::class);
$this->mock(TransactionGroupRepositoryInterface::class);
// mocks:
$recurringRepos->shouldReceive('getAll')->atLeast()->once()->andReturn(new Collection([$recurrence]));
2019-08-29 17:53:25 +02:00
$recurringRepos->shouldReceive('getJournalCount')->atLeast()->once()->andReturn(1);
2019-07-27 13:54:06 +02:00
Preferences::shouldReceive('mark')->atLeast()->once();
$date = new Carbon();
$job = new CreateRecurringTransactions($date);
$job->handle();
$this->assertEquals(0, $job->created);
$this->assertEquals(0, $job->executed);
$this->assertEquals(1, $job->submitted);
2019-08-29 17:53:25 +02:00
$recurrence->repetitions = 0;
2019-07-27 13:54:06 +02:00
$recurrence->save();
}
/**
2019-08-29 17:53:25 +02:00
* Submit one, but should no longer run.
2019-07-27 13:54:06 +02:00
*
* @covers \FireflyIII\Jobs\CreateRecurringTransactions
*/
2019-08-29 17:53:25 +02:00
public function testSingleOverDue(): void
2019-07-27 13:54:06 +02:00
{
2019-08-29 17:53:25 +02:00
Log::info(sprintf('Now in test %s.', __METHOD__));
2019-07-31 16:53:09 +02:00
// mock classes
2019-08-29 17:53:25 +02:00
$date = new Carbon();
$yesterday = clone $date;
$yesterday->subDays(3);
$recurrence = $this->getRandomRecurrence();
2019-07-27 13:54:06 +02:00
2019-08-29 17:53:25 +02:00
$recurrence->repeat_until = $yesterday;
2019-07-27 13:54:06 +02:00
$recurrence->save();
2019-08-29 17:53:25 +02:00
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$this->mock(JournalRepositoryInterface::class);
$this->mock(TransactionGroupRepositoryInterface::class);
2019-07-27 13:54:06 +02:00
2019-08-29 17:53:25 +02:00
// mocks:
2019-07-27 13:54:06 +02:00
$recurringRepos->shouldReceive('getAll')->atLeast()->once()->andReturn(new Collection([$recurrence]));
$recurringRepos->shouldReceive('getJournalCount')->atLeast()->once()->andReturn(0);
Preferences::shouldReceive('mark')->atLeast()->once();
$job = new CreateRecurringTransactions($date);
2019-08-29 17:53:25 +02:00
2019-07-27 13:54:06 +02:00
$job->handle();
2019-08-29 17:53:25 +02:00
$this->assertEquals(0, $job->created);
$this->assertEquals(0, $job->executed);
2019-07-27 13:54:06 +02:00
$this->assertEquals(1, $job->submitted);
2019-08-29 17:53:25 +02:00
$recurrence->repeat_until = null;
$recurrence->save();
}
2019-07-27 13:54:06 +02:00
/**
* Submit one, offer occurence for today.
*
* @covers \FireflyIII\Jobs\CreateRecurringTransactions
*/
2019-08-29 17:53:25 +02:00
public function testSingleToday(): void
2019-07-27 13:54:06 +02:00
{
Event::fake();
$date = new Carbon();
$this->expectsEvents([StoredTransactionGroup::class]);
2019-08-29 17:53:25 +02:00
// mock classes
2019-07-31 16:53:09 +02:00
$carbon = new Carbon;
$carbon->subDays(4);
$recurrence = $this->getRandomRecurrence();
$recurrence->latest_date = null;
$recurrence->first_date = $carbon;
$recurrence->save();
2019-08-29 17:53:25 +02:00
$group = $this->getRandomWithdrawalGroup();
2019-07-27 13:54:06 +02:00
// overrule some fields in the recurrence to make it seem it hasnt fired yet.
$recurrence->latest_date = null;
$recurrence->save();
// mock classes
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$groupRepos = $this->mock(TransactionGroupRepositoryInterface::class);
$piggyFactory = $this->mock(PiggyBankFactory::class);
$piggyEventFactory = $this->mock(PiggyBankEventFactory::class);
// mocks:
$groupRepos->shouldReceive('setUser')->atLeast()->once();
$journalRepos->shouldReceive('setUser')->atLeast()->once();
$recurringRepos->shouldReceive('setUser')->atLeast()->once();
$recurringRepos->shouldReceive('getOccurrencesInRange')->atLeast()->once()->andReturn([$date]);
$recurringRepos->shouldReceive('getAll')->atLeast()->once()->andReturn(new Collection([$recurrence]));
2019-08-29 17:53:25 +02:00
$recurringRepos->shouldReceive('getJournalCount')->atLeast()->once()->andReturn(0);
2019-07-27 13:54:06 +02:00
$recurringRepos->shouldReceive('getPiggyBank')->atLeast()->once()->andReturnNull();
Preferences::shouldReceive('mark')->atLeast()->once();
// return data:
$recurringRepos->shouldReceive('getBudget')->atLeast()->once()->andReturnNull();
$recurringRepos->shouldReceive('getCategory')->atLeast()->once()->andReturnNull();
$recurringRepos->shouldReceive('getTags')->atLeast()->once()->andReturn([]);
// store journal
$groupRepos->shouldReceive('store')->atLeast()->once()->andReturn($group);
//Event::assertDispatched(StoredTransactionGroup::class);
$job = new CreateRecurringTransactions($date);
$job->handle();
$this->assertEquals(1, $job->created);
$this->assertEquals(1, $job->executed);
$this->assertEquals(1, $job->submitted);
}
/**
* Submit one, offer occurence for today, with piggy
*
* @covers \FireflyIII\Jobs\CreateRecurringTransactions
*/
public function testSingleTodayPiggy(): void
{
Event::fake();
$date = new Carbon();
$this->expectsEvents([StoredTransactionGroup::class]);
2019-07-31 16:53:09 +02:00
2019-08-29 17:53:25 +02:00
$group = $this->getRandomWithdrawalGroup();
2019-07-27 13:54:06 +02:00
$piggy = $this->getRandomPiggyBank();
// overrule some fields in the recurrence to make it seem it hasnt fired yet.
2019-07-31 16:53:09 +02:00
$carbon = new Carbon;
$carbon->subDays(4);
$recurrence = $this->getRandomRecurrence();
2019-07-27 13:54:06 +02:00
$recurrence->latest_date = null;
2019-07-31 16:53:09 +02:00
$recurrence->first_date = $carbon;
2019-07-27 13:54:06 +02:00
$recurrence->save();
// mock classes
$recurringRepos = $this->mock(RecurringRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$groupRepos = $this->mock(TransactionGroupRepositoryInterface::class);
$piggyEventFactory = $this->mock(PiggyBankEventFactory::class);
// mocks:
$groupRepos->shouldReceive('setUser')->atLeast()->once();
$journalRepos->shouldReceive('setUser')->atLeast()->once();
$recurringRepos->shouldReceive('setUser')->atLeast()->once();
$recurringRepos->shouldReceive('getOccurrencesInRange')->atLeast()->once()->andReturn([$date]);
$recurringRepos->shouldReceive('getAll')->atLeast()->once()->andReturn(new Collection([$recurrence]));
$recurringRepos->shouldReceive('getJournalCount')->atLeast()->once()->andReturn(0);
$recurringRepos->shouldReceive('getPiggyBank')->atLeast()->once()->andReturn($piggy);
$piggyEventFactory->shouldReceive('create')->once();
Preferences::shouldReceive('mark')->atLeast()->once();
// return data:
$recurringRepos->shouldReceive('getBudget')->atLeast()->once()->andReturnNull();
$recurringRepos->shouldReceive('getCategory')->atLeast()->once()->andReturnNull();
$recurringRepos->shouldReceive('getTags')->atLeast()->once()->andReturn([]);
// store journal
$groupRepos->shouldReceive('store')->atLeast()->once()->andReturn($group);
//Event::assertDispatched(StoredTransactionGroup::class);
$job = new CreateRecurringTransactions($date);
$job->handle();
$this->assertEquals(1, $job->created);
$this->assertEquals(1, $job->executed);
$this->assertEquals(1, $job->submitted);
}
2019-08-17 12:09:03 +02:00
}