mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 10:47:00 +00:00 
			
		
		
		
	Disable all kinds of tests until upgrades are complete.
This commit is contained in:
		| @@ -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