mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 18:44:16 +00:00
Also implement #595 for the no-cat view.
This commit is contained in:
@@ -123,12 +123,20 @@ class CategoryControllerTest extends TestCase
|
||||
// mock stuff
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$journalRepos->shouldReceive('first')->twice()->andReturn(new TransactionJournal);
|
||||
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
|
||||
$collector->shouldReceive('setTypes')->andReturnSelf();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf();
|
||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
||||
$collector->shouldReceive('withoutCategory')->andReturnSelf();
|
||||
$collector->shouldReceive('getJournals')->andReturn(new Collection);
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
|
||||
|
||||
$collector->shouldReceive('setPage')->andReturnSelf();
|
||||
$collector->shouldReceive('disableInternalFilter')->andReturnSelf();
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
@@ -138,6 +146,72 @@ class CategoryControllerTest extends TestCase
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::noCategory
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testNoCategoryAll(string $range)
|
||||
{
|
||||
// mock stuff
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->twice()->andReturn(new TransactionJournal);
|
||||
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
|
||||
$collector->shouldReceive('setTypes')->andReturnSelf();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf();
|
||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
||||
$collector->shouldReceive('withoutCategory')->andReturnSelf();
|
||||
$collector->shouldReceive('getJournals')->andReturn(new Collection);
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
|
||||
|
||||
$collector->shouldReceive('setPage')->andReturnSelf();
|
||||
$collector->shouldReceive('disableInternalFilter')->andReturnSelf();
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$response = $this->get(route('categories.no-category', ['all']));
|
||||
$response->assertStatus(200);
|
||||
// has bread crumb
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::noCategory
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testNoCategoryDate(string $range)
|
||||
{
|
||||
// mock stuff
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('first')->twice()->andReturn(new TransactionJournal);
|
||||
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf();
|
||||
$collector->shouldReceive('setTypes')->andReturnSelf();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf();
|
||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
||||
$collector->shouldReceive('withoutCategory')->andReturnSelf();
|
||||
$collector->shouldReceive('getJournals')->andReturn(new Collection);
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
|
||||
|
||||
$collector->shouldReceive('setPage')->andReturnSelf();
|
||||
$collector->shouldReceive('disableInternalFilter')->andReturnSelf();
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$response = $this->get(route('categories.no-category', ['2016-01-01']));
|
||||
$response->assertStatus(200);
|
||||
// has bread crumb
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::show
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::getGroupedEntries
|
||||
|
Reference in New Issue
Block a user