mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
This fixes the tests.
This commit is contained in:
parent
6151d4a0ec
commit
9c6a3e4ad5
@ -320,6 +320,14 @@ Breadcrumbs::register(
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'categories.show.all', function (BreadCrumbGenerator $breadcrumbs, Category $category) {
|
||||
$breadcrumbs->parent('categories.index');
|
||||
$breadcrumbs->push(e($category->name) . '(' . strtolower(trans('firefly.all_periods')) . ')', route('categories.show.all', [$category->id]));
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'categories.show.date', function (BreadCrumbGenerator $breadcrumbs, Category $category, Carbon $date) {
|
||||
|
||||
|
@ -145,8 +145,10 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->orderBy('transaction_journals.date', 'ASC')->first(['transaction_journals.date']);
|
||||
|
||||
|
||||
|
||||
// both exist, the one that is earliest "wins".
|
||||
if (!is_null($firstTransaction) && !is_null($first) && $firstTransaction->date->lt($first)) {
|
||||
if (!is_null($firstTransaction) && !is_null($first) && Carbon::parse($firstTransaction->date)->lt($first)) {
|
||||
$first = $firstTransaction->date;
|
||||
}
|
||||
|
||||
|
@ -128,6 +128,22 @@ class AccountControllerTest extends TestCase
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\AccountController::showWithDate
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testShowAll(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('accounts.show.all', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
// has bread crumb
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\AccountController::showWithDate
|
||||
* @dataProvider dateRangeProvider
|
||||
|
@ -132,6 +132,7 @@ class CategoryControllerTest extends TestCase
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('withBudgetInformation')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setCategory')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->once();
|
||||
|
||||
@ -147,6 +148,32 @@ class CategoryControllerTest extends TestCase
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::showAll
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testShowAll(string $range)
|
||||
{
|
||||
$collector = $this->mock(JournalCollectorInterface::class);
|
||||
|
||||
// collector stuff:
|
||||
$collector->shouldReceive('setPage')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('withBudgetInformation')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setCategory')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->once();
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$this->call('GET', route('categories.show.all', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
$this->see('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\CategoryController::showByDate
|
||||
* @dataProvider dateRangeProvider
|
||||
@ -162,6 +189,7 @@ class CategoryControllerTest extends TestCase
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setRange')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('withBudgetInformation')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('setCategory')->andReturnSelf()->once();
|
||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([], 0, 10))->once();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user