Improve test coverage.

This commit is contained in:
James Cole
2019-07-25 14:19:49 +02:00
parent ee95606ec0
commit 6ff4a0b45c
61 changed files with 822 additions and 599 deletions

View File

@@ -30,6 +30,7 @@ use FireflyIII\Support\Cronjobs\RecurringCronjob;
use Illuminate\Support\Collection;
use Log;
use Mockery;
use Preferences;
use Tests\TestCase;
/**
@@ -61,7 +62,7 @@ class CronControllerTest extends TestCase
$job->shouldReceive('fire')->once()->andReturn(true);
$repository = $this->mock(UserRepositoryInterface::class);
$repository->shouldReceive('all')->andReturn($users);
\Preferences::shouldReceive('getForUser')
Preferences::shouldReceive('getForUser')
->withArgs([Mockery::any(), 'access_token', null])
->andReturn($preference)->once();
$response = $this->get(route('cron.cron', ['token']));
@@ -83,7 +84,7 @@ class CronControllerTest extends TestCase
$job->shouldReceive('fire')->once()->andThrow(new FireflyException('Exception noted.'));
$repository = $this->mock(UserRepositoryInterface::class);
$repository->shouldReceive('all')->andReturn($users);
\Preferences::shouldReceive('getForUser')
Preferences::shouldReceive('getForUser')
->withArgs([Mockery::any(), 'access_token', null])
->andReturn($preference)->once();
$response = $this->get(route('cron.cron', ['token']));
@@ -105,7 +106,7 @@ class CronControllerTest extends TestCase
$job->shouldReceive('fire')->once()->andReturn(false);
$repository = $this->mock(UserRepositoryInterface::class);
$repository->shouldReceive('all')->andReturn($users);
\Preferences::shouldReceive('getForUser')
Preferences::shouldReceive('getForUser')
->withArgs([Mockery::any(), 'access_token', null])
->andReturn($preference)->once();
$response = $this->get(route('cron.cron', ['token']));