Fix coverage.

This commit is contained in:
James Cole 2018-04-28 05:40:23 +02:00
parent 9c5523252d
commit b66daad3d3
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E

View File

@ -72,21 +72,22 @@ class PiggyBankEventFactoryTest extends TestCase
}
/**
* Test for withdrawal where piggy has no repetition.
*
* @covers \FireflyIII\Factory\PiggyBankEventFactory
*/
public function testCreateNoRep()
public function testCreateNoRep(): void
{
/** @var TransactionJournal $transfer */
$transfer = $this->user()->transactionJournals()->where('transaction_type_id', 3)->first();
$piggy = $this->user()->piggyBanks()->first();
$repetition = new PiggyBankRepetition;
$repos = $this->mock(PiggyBankRepositoryInterface::class);
$transfer = $this->user()->transactionJournals()->where('transaction_type_id', 3)->first();
$piggy = $this->user()->piggyBanks()->first();
$repos = $this->mock(PiggyBankRepositoryInterface::class);
/** @var PiggyBankEventFactory $factory */
$factory = app(PiggyBankEventFactory::class);
// mock:
$repos->shouldReceive('setUser');
$repos->shouldReceive('getRepetition')->andReturn($repetition);
$repos->shouldReceive('getRepetition')->andReturn(null);
$repos->shouldReceive('getExactAmount')->andReturn('0');
$this->assertNull($factory->create($transfer, $piggy));