Fix coverage.

This commit is contained in:
James Cole
2018-04-28 05:40:23 +02:00
parent 9c5523252d
commit b66daad3d3

View File

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