mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-10 12:24:50 +00:00
Improve test coverage.
This commit is contained in:
@@ -68,16 +68,18 @@ class PiggyBankEventTransformerTest extends TestCase
|
||||
// mock calls:
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->atLeast()->once()->andReturn(1);
|
||||
$currencyRepos->shouldReceive('findNull')->withArgs([1])->atLeast()->once()->andReturn($this->getEuro());
|
||||
$piggyRepos->shouldReceive('getTransactionWithEvent')->atLeast()->once()->andReturn(123);
|
||||
|
||||
$event = PiggyBankEvent::first();
|
||||
$event = $this->getRandomPiggyBankEvent();
|
||||
|
||||
|
||||
|
||||
$transformer = app(PiggyBankEventTransformer::class);
|
||||
$transformer->setParameters(new ParameterBag);
|
||||
|
||||
$result = $transformer->transform($event);
|
||||
$this->assertEquals($event->id, $result['id']);
|
||||
$this->assertEquals(245, $result['amount']);
|
||||
$this->assertEquals(123, $result['transaction_id']);
|
||||
$this->assertEquals($event->amount, $result['amount']);
|
||||
$this->assertEquals($event->transaction_journal_id, $result['transaction_journal_id']);
|
||||
|
||||
}
|
||||
|
||||
@@ -100,18 +102,17 @@ class PiggyBankEventTransformerTest extends TestCase
|
||||
// mock calls:
|
||||
$accountRepos->shouldReceive('getMetaValue')->withArgs([Mockery::any(), 'currency_id'])->atLeast()->once()->andReturn(1);
|
||||
$currencyRepos->shouldReceive('findNull')->withArgs([1])->atLeast()->once()->andReturn(null);
|
||||
$piggyRepos->shouldReceive('getTransactionWithEvent')->atLeast()->once()->andReturn(123);
|
||||
|
||||
Amount::shouldReceive('getDefaultCurrencyByUser')->andReturn($this->getEuro())->atLeast()->once();
|
||||
|
||||
$event = PiggyBankEvent::first();
|
||||
$event = $this->getRandomPiggyBankEvent();
|
||||
$transformer = app(PiggyBankEventTransformer::class);
|
||||
$transformer->setParameters(new ParameterBag);
|
||||
|
||||
$result = $transformer->transform($event);
|
||||
$this->assertEquals($event->id, $result['id']);
|
||||
$this->assertEquals(245, $result['amount']);
|
||||
$this->assertEquals(123, $result['transaction_id']);
|
||||
$this->assertEquals($event->amount, $result['amount']);
|
||||
$this->assertEquals($event->transaction_journal_id, $result['transaction_journal_id']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user