mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Expand test coverage.
This commit is contained in:
parent
602b35d589
commit
9a2c6c2967
@ -84,10 +84,10 @@ class AccountController extends Controller
|
|||||||
$step = '1W';
|
$step = '1W';
|
||||||
}
|
}
|
||||||
if ($months > 24) {
|
if ($months > 24) {
|
||||||
$step = '1M';
|
$step = '1M'; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
if ($months > 100) {
|
if ($months > 100) {
|
||||||
$step = '1Y';
|
$step = '1Y'; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
$chartData = [];
|
$chartData = [];
|
||||||
$current = clone $start;
|
$current = clone $start;
|
||||||
@ -106,8 +106,8 @@ class AccountController extends Controller
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '1W':
|
case '1W':
|
||||||
case '1M':
|
case '1M': // @codeCoverageIgnore
|
||||||
case '1Y':
|
case '1Y': // @codeCoverageIgnore
|
||||||
while ($end >= $current) {
|
while ($end >= $current) {
|
||||||
$balance = floatval(Steam::balance($account, $current));
|
$balance = floatval(Steam::balance($account, $current));
|
||||||
$label = app('navigation')->periodShow($current, $step);
|
$label = app('navigation')->periodShow($current, $step);
|
||||||
|
@ -33,6 +33,7 @@ use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
|||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Navigation;
|
||||||
use Steam;
|
use Steam;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
@ -229,6 +230,13 @@ class CategoryControllerTest extends TestCase
|
|||||||
$collector->shouldReceive('removeFilter')->withArgs([InternalTransferFilter::class])->andReturnSelf();
|
$collector->shouldReceive('removeFilter')->withArgs([InternalTransferFilter::class])->andReturnSelf();
|
||||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||||
|
|
||||||
|
Navigation::shouldReceive('updateStartDate')->andReturn(new Carbon);
|
||||||
|
Navigation::shouldReceive('updateEndDate')->andReturn(new Carbon);
|
||||||
|
Navigation::shouldReceive('startOfPeriod')->andReturn(new Carbon);
|
||||||
|
Navigation::shouldReceive('endOfPeriod')->andReturn(new Carbon);
|
||||||
|
Navigation::shouldReceive('periodShow')->andReturn('Some date');
|
||||||
|
Navigation::shouldReceive('blockPeriods')->andReturn([['period' =>'1M','start' => new Carbon, 'end' => new Carbon]])->once();
|
||||||
|
|
||||||
$this->be($this->user());
|
$this->be($this->user());
|
||||||
$this->changeDateRange($this->user(), $range);
|
$this->changeDateRange($this->user(), $range);
|
||||||
$response = $this->get(route('categories.no-category', ['2016-01-01']));
|
$response = $this->get(route('categories.no-category', ['2016-01-01']));
|
||||||
@ -262,15 +270,25 @@ class CategoryControllerTest extends TestCase
|
|||||||
$collector = $this->mock(JournalCollectorInterface::class);
|
$collector = $this->mock(JournalCollectorInterface::class);
|
||||||
$collector->shouldReceive('setPage')->andReturnSelf()->once();
|
$collector->shouldReceive('setPage')->andReturnSelf()->once();
|
||||||
$collector->shouldReceive('setLimit')->andReturnSelf()->once();
|
$collector->shouldReceive('setLimit')->andReturnSelf()->once();
|
||||||
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->once();
|
$collector->shouldReceive('setAllAssetAccounts')->andReturnSelf()->atLeast(2);
|
||||||
$collector->shouldReceive('setRange')->andReturnSelf()->once();
|
$collector->shouldReceive('setRange')->andReturnSelf()->atLeast(2);
|
||||||
$collector->shouldReceive('removeFilter')->withArgs([InternalTransferFilter::class])->andReturnSelf()->once();
|
$collector->shouldReceive('removeFilter')->withArgs([InternalTransferFilter::class])->andReturnSelf()->atLeast(2);
|
||||||
$collector->shouldReceive('withBudgetInformation')->andReturnSelf()->once();
|
$collector->shouldReceive('withBudgetInformation')->andReturnSelf()->once();
|
||||||
$collector->shouldReceive('withCategoryInformation')->andReturnSelf()->once();
|
$collector->shouldReceive('withCategoryInformation')->andReturnSelf()->once();
|
||||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf()->once();
|
$collector->shouldReceive('withOpposingAccount')->andReturnSelf()->atLeast(2);
|
||||||
$collector->shouldReceive('setCategory')->andReturnSelf()->once();
|
$collector->shouldReceive('setCategory')->andReturnSelf()->atLeast(2);
|
||||||
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10))->once();
|
$collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10))->once();
|
||||||
|
|
||||||
|
$collector->shouldReceive('setTypes')->andReturnSelf()->atLeast(1);
|
||||||
|
$collector->shouldReceive('getJournals')->andReturn(new Collection)->atLeast(1);
|
||||||
|
|
||||||
|
Navigation::shouldReceive('updateStartDate')->andReturn(new Carbon);
|
||||||
|
Navigation::shouldReceive('updateEndDate')->andReturn(new Carbon);
|
||||||
|
Navigation::shouldReceive('startOfPeriod')->andReturn(new Carbon);
|
||||||
|
Navigation::shouldReceive('endOfPeriod')->andReturn(new Carbon);
|
||||||
|
Navigation::shouldReceive('periodShow')->andReturn('Some date');
|
||||||
|
Navigation::shouldReceive('blockPeriods')->andReturn([['period' =>'1M','start' => new Carbon, 'end' => new Carbon]])->once();
|
||||||
|
|
||||||
$this->be($this->user());
|
$this->be($this->user());
|
||||||
$this->changeDateRange($this->user(), $range);
|
$this->changeDateRange($this->user(), $range);
|
||||||
$response = $this->get(route('categories.show', [1]));
|
$response = $this->get(route('categories.show', [1]));
|
||||||
|
@ -64,6 +64,26 @@ class AccountControllerTest extends TestCase
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::all
|
||||||
|
*/
|
||||||
|
public function testAllLongRange()
|
||||||
|
{
|
||||||
|
$generator = $this->mock(GeneratorInterface::class);
|
||||||
|
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||||
|
|
||||||
|
$carbon = new Carbon;
|
||||||
|
$carbon->subMonths(5);
|
||||||
|
$accountRepos->shouldReceive('oldestJournalDate')->once()->andReturn($carbon);
|
||||||
|
Steam::shouldReceive('balance')->andReturn('0');
|
||||||
|
|
||||||
|
$generator->shouldReceive('singleSet')->andReturn([]);
|
||||||
|
|
||||||
|
$this->be($this->user());
|
||||||
|
$response = $this->get(route('chart.account.all', [1]));
|
||||||
|
$response->assertStatus(200);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::expenseAccounts
|
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::expenseAccounts
|
||||||
* @covers \FireflyIII\Generator\Chart\Basic\GeneratorInterface::singleSet
|
* @covers \FireflyIII\Generator\Chart\Basic\GeneratorInterface::singleSet
|
||||||
|
@ -43,6 +43,7 @@ class DebugControllerTest extends TestCase
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Http\Controllers\DebugController::index
|
* @covers \FireflyIII\Http\Controllers\DebugController::index
|
||||||
|
* @covers \FireflyIII\Http\Controllers\DebugController::__construct
|
||||||
* @covers \FireflyIII\Http\Controllers\DebugController::errorReporting
|
* @covers \FireflyIII\Http\Controllers\DebugController::errorReporting
|
||||||
* @covers \FireflyIII\Http\Controllers\DebugController::collectPackages
|
* @covers \FireflyIII\Http\Controllers\DebugController::collectPackages
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user