mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-16 14:48:11 +00:00
Code cleanup for #595
This commit is contained in:
@@ -97,10 +97,14 @@ class BillControllerTest extends TestCase
|
||||
public function testIndex()
|
||||
{
|
||||
// mock stuff
|
||||
$bill = factory(Bill::class)->make();
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
$repository->shouldReceive('getBills')->andReturn(new Collection);
|
||||
$repository->shouldReceive('getBills')->andReturn(new Collection([$bill]));
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('getPaidDatesInRange')->once()->andReturn(new Collection([1, 2, 3]));
|
||||
$repository->shouldReceive('getPayDatesInRange')->once()->andReturn(new Collection([1, 2]));
|
||||
$repository->shouldReceive('nextExpectedMatch')->andReturn(new Carbon);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('bills.index'));
|
||||
@@ -115,9 +119,11 @@ class BillControllerTest extends TestCase
|
||||
public function testRescan()
|
||||
{
|
||||
// mock stuff
|
||||
$journal = factory(TransactionJournal::class)->make();
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
$repository->shouldReceive('getPossiblyRelatedJournals')->once()->andReturn(new Collection);
|
||||
$repository->shouldReceive('getPossiblyRelatedJournals')->once()->andReturn(new Collection([$journal]));
|
||||
$repository->shouldReceive('scan')->once();
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
@@ -126,6 +132,22 @@ class BillControllerTest extends TestCase
|
||||
$response->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::rescan
|
||||
*/
|
||||
public function testRescanInactive()
|
||||
{
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$repository = $this->mock(BillRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('bills.rescan', [3]));
|
||||
$response->assertStatus(302);
|
||||
$response->assertSessionHas('warning');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BillController::show
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user