mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-09 20:11:22 +00:00
Disable all kinds of tests until upgrades are complete.
This commit is contained in:
@@ -30,9 +30,9 @@ use FireflyIII\Models\ImportJob;
|
||||
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
||||
use FireflyIII\Support\Import\Routine\Bunq\StageImportDataHandler;
|
||||
use FireflyIII\Support\Import\Routine\Bunq\StageNewHandler;
|
||||
use Log;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class BunqRoutineTest
|
||||
@@ -109,7 +109,6 @@ class BunqRoutineTest extends TestCase
|
||||
$handler = $this->mock(StageImportDataHandler::class);
|
||||
|
||||
|
||||
|
||||
$handler->shouldReceive('setImportJob')->once();
|
||||
$handler->shouldReceive('run')->once();
|
||||
$handler->shouldReceive('getTransactions')->once()->andReturn(['a' => 'c']);
|
||||
@@ -123,7 +122,6 @@ class BunqRoutineTest extends TestCase
|
||||
$repository->shouldReceive('appendTransactions')->withArgs([Mockery::any(), ['a' => 'c']])->once();
|
||||
|
||||
|
||||
|
||||
$routine = new BunqRoutine;
|
||||
$routine->setImportJob($job);
|
||||
try {
|
||||
|
||||
@@ -30,9 +30,9 @@ use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
||||
use FireflyIII\Support\Import\Routine\Fake\StageAhoyHandler;
|
||||
use FireflyIII\Support\Import\Routine\Fake\StageFinalHandler;
|
||||
use FireflyIII\Support\Import\Routine\Fake\StageNewHandler;
|
||||
use Log;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class FakeRoutineTest
|
||||
|
||||
@@ -29,9 +29,9 @@ use FireflyIII\Import\Routine\FileRoutine;
|
||||
use FireflyIII\Models\ImportJob;
|
||||
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
||||
use FireflyIII\Support\Import\Routine\File\CSVProcessor;
|
||||
use Log;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class FileRoutineTest
|
||||
|
||||
@@ -31,9 +31,9 @@ use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
||||
use FireflyIII\Support\Import\Routine\Spectre\StageAuthenticatedHandler;
|
||||
use FireflyIII\Support\Import\Routine\Spectre\StageImportDataHandler;
|
||||
use FireflyIII\Support\Import\Routine\Spectre\StageNewHandler;
|
||||
use Log;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class SpectreRoutineTest
|
||||
|
||||
@@ -50,6 +50,68 @@ class YnabRoutineTest extends TestCase
|
||||
Log::info(sprintf('Now in %s.', \get_class($this)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Import\Routine\YnabRoutine
|
||||
*/
|
||||
public function testRunBadStatus(): void
|
||||
{
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'ynab_r_7_' . random_int(1, 10000);
|
||||
$job->status = 'not_ready_to_run';
|
||||
$job->stage = 'bad_state';
|
||||
$job->provider = 'ynab';
|
||||
$job->file_type = '';
|
||||
$job->configuration = [];
|
||||
$job->save();
|
||||
|
||||
// mock handler and repository
|
||||
$handler = $this->mock(ImportDataHandler::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
|
||||
// mock calls for repository
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
|
||||
$routine = new YnabRoutine;
|
||||
$routine->setImportJob($job);
|
||||
try {
|
||||
$routine->run();
|
||||
} catch (FireflyException $e) {
|
||||
$this->assertEquals('YNAB import routine cannot handle stage "bad_state"', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Import\Routine\YnabRoutine
|
||||
*/
|
||||
public function testRunException(): void
|
||||
{
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'ynab_r_6_' . random_int(1, 10000);
|
||||
$job->status = 'ready_to_run';
|
||||
$job->stage = 'bad_state';
|
||||
$job->provider = 'ynab';
|
||||
$job->file_type = '';
|
||||
$job->configuration = [];
|
||||
$job->save();
|
||||
|
||||
// mock handler and repository
|
||||
$handler = $this->mock(ImportDataHandler::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
|
||||
// mock calls for repository
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
|
||||
$routine = new YnabRoutine;
|
||||
$routine->setImportJob($job);
|
||||
try {
|
||||
$routine->run();
|
||||
} catch (FireflyException $e) {
|
||||
$this->assertEquals('YNAB import routine cannot handle stage "bad_state"', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Import\Routine\YnabRoutine
|
||||
*/
|
||||
@@ -89,6 +151,87 @@ class YnabRoutineTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Import\Routine\YnabRoutine
|
||||
*/
|
||||
public function testRunGetAccounts(): void
|
||||
{
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'ynab_r_4_' . random_int(1, 10000);
|
||||
$job->status = 'ready_to_run';
|
||||
$job->stage = 'get_accounts';
|
||||
$job->provider = 'ynab';
|
||||
$job->file_type = '';
|
||||
$job->configuration = [];
|
||||
$job->save();
|
||||
|
||||
// mock handler and repository
|
||||
$handler = $this->mock(GetAccountsHandler::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
|
||||
// mock calls for repository
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
$repository->shouldReceive('setStatus')->withArgs([Mockery::any(), 'running'])->once();
|
||||
|
||||
$repository->shouldReceive('setStage')->withArgs([Mockery::any(), 'select_accounts'])->once();
|
||||
$repository->shouldReceive('setStatus')->withArgs([Mockery::any(), 'need_job_config'])->once();
|
||||
|
||||
|
||||
// mock calls for handler
|
||||
$handler->shouldReceive('setImportJob')->once();
|
||||
$handler->shouldReceive('run')->once();
|
||||
|
||||
$routine = new YnabRoutine;
|
||||
$routine->setImportJob($job);
|
||||
try {
|
||||
$routine->run();
|
||||
} catch (FireflyException $e) {
|
||||
$this->assertTrue(false, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Import\Routine\YnabRoutine
|
||||
*/
|
||||
public function testRunGoForImport(): void
|
||||
{
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'ynab_r_5_' . random_int(1, 10000);
|
||||
$job->status = 'ready_to_run';
|
||||
$job->stage = 'go-for-import';
|
||||
$job->provider = 'ynab';
|
||||
$job->file_type = '';
|
||||
$job->configuration = [];
|
||||
$job->save();
|
||||
|
||||
// mock handler and repository
|
||||
$handler = $this->mock(ImportDataHandler::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
|
||||
// mock calls for repository
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
$repository->shouldReceive('setStatus')->withArgs([Mockery::any(), 'running'])->once();
|
||||
$repository->shouldReceive('setStage')->withArgs([Mockery::any(), 'do_import'])->once();
|
||||
|
||||
$repository->shouldReceive('setStatus')->withArgs([Mockery::any(), 'provider_finished'])->once();
|
||||
$repository->shouldReceive('setStage')->withArgs([Mockery::any(), 'final'])->once();
|
||||
|
||||
|
||||
// mock calls for handler
|
||||
$handler->shouldReceive('setImportJob')->once();
|
||||
$handler->shouldReceive('run')->once();
|
||||
|
||||
$routine = new YnabRoutine;
|
||||
$routine->setImportJob($job);
|
||||
try {
|
||||
$routine->run();
|
||||
} catch (FireflyException $e) {
|
||||
$this->assertTrue(false, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Import\Routine\YnabRoutine
|
||||
*/
|
||||
@@ -172,148 +315,4 @@ class YnabRoutineTest extends TestCase
|
||||
$this->assertTrue(false, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Import\Routine\YnabRoutine
|
||||
*/
|
||||
public function testRunGetAccounts(): void
|
||||
{
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'ynab_r_4_' . random_int(1, 10000);
|
||||
$job->status = 'ready_to_run';
|
||||
$job->stage = 'get_accounts';
|
||||
$job->provider = 'ynab';
|
||||
$job->file_type = '';
|
||||
$job->configuration = [];
|
||||
$job->save();
|
||||
|
||||
// mock handler and repository
|
||||
$handler = $this->mock(GetAccountsHandler::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
|
||||
// mock calls for repository
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
$repository->shouldReceive('setStatus')->withArgs([Mockery::any(), 'running'])->once();
|
||||
|
||||
$repository->shouldReceive('setStage')->withArgs([Mockery::any(), 'select_accounts'])->once();
|
||||
$repository->shouldReceive('setStatus')->withArgs([Mockery::any(), 'need_job_config'])->once();
|
||||
|
||||
|
||||
// mock calls for handler
|
||||
$handler->shouldReceive('setImportJob')->once();
|
||||
$handler->shouldReceive('run')->once();
|
||||
|
||||
$routine = new YnabRoutine;
|
||||
$routine->setImportJob($job);
|
||||
try {
|
||||
$routine->run();
|
||||
} catch (FireflyException $e) {
|
||||
$this->assertTrue(false, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Import\Routine\YnabRoutine
|
||||
*/
|
||||
public function testRunGoForImport(): void
|
||||
{
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'ynab_r_5_' . random_int(1, 10000);
|
||||
$job->status = 'ready_to_run';
|
||||
$job->stage = 'go-for-import';
|
||||
$job->provider = 'ynab';
|
||||
$job->file_type = '';
|
||||
$job->configuration = [];
|
||||
$job->save();
|
||||
|
||||
// mock handler and repository
|
||||
$handler = $this->mock(ImportDataHandler::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
|
||||
// mock calls for repository
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
$repository->shouldReceive('setStatus')->withArgs([Mockery::any(), 'running'])->once();
|
||||
$repository->shouldReceive('setStage')->withArgs([Mockery::any(), 'do_import'])->once();
|
||||
|
||||
$repository->shouldReceive('setStatus')->withArgs([Mockery::any(), 'provider_finished'])->once();
|
||||
$repository->shouldReceive('setStage')->withArgs([Mockery::any(), 'final'])->once();
|
||||
|
||||
|
||||
|
||||
// mock calls for handler
|
||||
$handler->shouldReceive('setImportJob')->once();
|
||||
$handler->shouldReceive('run')->once();
|
||||
|
||||
$routine = new YnabRoutine;
|
||||
$routine->setImportJob($job);
|
||||
try {
|
||||
$routine->run();
|
||||
} catch (FireflyException $e) {
|
||||
$this->assertTrue(false, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Import\Routine\YnabRoutine
|
||||
*/
|
||||
public function testRunException(): void
|
||||
{
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'ynab_r_6_' . random_int(1, 10000);
|
||||
$job->status = 'ready_to_run';
|
||||
$job->stage = 'bad_state';
|
||||
$job->provider = 'ynab';
|
||||
$job->file_type = '';
|
||||
$job->configuration = [];
|
||||
$job->save();
|
||||
|
||||
// mock handler and repository
|
||||
$handler = $this->mock(ImportDataHandler::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
|
||||
// mock calls for repository
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
|
||||
$routine = new YnabRoutine;
|
||||
$routine->setImportJob($job);
|
||||
try {
|
||||
$routine->run();
|
||||
} catch (FireflyException $e) {
|
||||
$this->assertEquals('YNAB import routine cannot handle stage "bad_state"', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Import\Routine\YnabRoutine
|
||||
*/
|
||||
public function testRunBadStatus(): void
|
||||
{
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'ynab_r_7_' . random_int(1, 10000);
|
||||
$job->status = 'not_ready_to_run';
|
||||
$job->stage = 'bad_state';
|
||||
$job->provider = 'ynab';
|
||||
$job->file_type = '';
|
||||
$job->configuration = [];
|
||||
$job->save();
|
||||
|
||||
// mock handler and repository
|
||||
$handler = $this->mock(ImportDataHandler::class);
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
|
||||
// mock calls for repository
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
|
||||
$routine = new YnabRoutine;
|
||||
$routine->setImportJob($job);
|
||||
try {
|
||||
$routine->run();
|
||||
} catch (FireflyException $e) {
|
||||
$this->assertEquals('YNAB import routine cannot handle stage "bad_state"', $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user