mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Update tests so repositories are not called. Saves on DB calls, speeds up tests.
This commit is contained in:
@@ -35,9 +35,9 @@ use FireflyIII\Support\Import\JobConfiguration\File\ConfigureMappingHandler;
|
||||
use Illuminate\Support\Collection;
|
||||
use League\Csv\Exception;
|
||||
use League\Csv\Reader;
|
||||
use Log;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class ConfigureMappingHandlerTest
|
||||
@@ -59,6 +59,8 @@ class ConfigureMappingHandlerTest extends TestCase
|
||||
*/
|
||||
public function testApplySpecifics(): void
|
||||
{
|
||||
$importRepos = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$importRepos->shouldReceive('setUser')->once();
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'mapG' . random_int(1, 10000);
|
||||
@@ -94,6 +96,7 @@ class ConfigureMappingHandlerTest extends TestCase
|
||||
*/
|
||||
public function testConfigureJob(): void
|
||||
{
|
||||
|
||||
// create fake input for class method:
|
||||
$input = [
|
||||
'mapping' => [
|
||||
@@ -158,6 +161,8 @@ class ConfigureMappingHandlerTest extends TestCase
|
||||
*/
|
||||
public function testDoColumnConfig(): void
|
||||
{
|
||||
$importRepos = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$importRepos->shouldReceive('setUser')->once();
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'mapE' . random_int(1, 10000);
|
||||
@@ -221,7 +226,8 @@ class ConfigureMappingHandlerTest extends TestCase
|
||||
*/
|
||||
public function testDoMapOfColumn(): void
|
||||
{
|
||||
|
||||
$importRepos = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$importRepos->shouldReceive('setUser')->once();
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'mapC' . random_int(1, 10000);
|
||||
@@ -251,6 +257,7 @@ class ConfigureMappingHandlerTest extends TestCase
|
||||
*/
|
||||
public function testGetNextData(): void
|
||||
{
|
||||
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'mapH' . random_int(1, 10000);
|
||||
@@ -332,6 +339,8 @@ class ConfigureMappingHandlerTest extends TestCase
|
||||
*/
|
||||
public function testGetPreProcessorName(): void
|
||||
{
|
||||
$importRepos = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$importRepos->shouldReceive('setUser')->once();
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'mapD' . random_int(1, 10000);
|
||||
@@ -360,6 +369,7 @@ class ConfigureMappingHandlerTest extends TestCase
|
||||
*/
|
||||
public function testGetReader(): void
|
||||
{
|
||||
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'mapF' . random_int(1, 10000);
|
||||
@@ -408,6 +418,8 @@ class ConfigureMappingHandlerTest extends TestCase
|
||||
*/
|
||||
public function testGetValuesForMapping(): void
|
||||
{
|
||||
$importRepos = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$importRepos->shouldReceive('setUser')->once();
|
||||
// create a reader to use in method.
|
||||
// 5 columns, of which #4 (index 3) is budget-id
|
||||
// 5 columns, of which #5 (index 4) is tags-space
|
||||
@@ -475,7 +487,8 @@ class ConfigureMappingHandlerTest extends TestCase
|
||||
*/
|
||||
public function testSanitizeColumnName(): void
|
||||
{
|
||||
|
||||
$importRepos = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$importRepos->shouldReceive('setUser')->once();
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'mapB' . random_int(1, 10000);
|
||||
|
||||
Reference in New Issue
Block a user