Fix tests.

This commit is contained in:
James Cole
2018-08-17 06:45:57 +02:00
parent df0e2dd2a2
commit f319005357
11 changed files with 46 additions and 70 deletions

View File

@@ -138,6 +138,7 @@ class ChooseAccountsHandlerTest extends TestCase
];
$expected = $config;
$expected['mapping'][1234] = 456;
$expected['bunq-iban'] = [];
// mock stuff
$repository = $this->mock(ImportJobRepositoryInterface::class);
@@ -148,7 +149,7 @@ class ChooseAccountsHandlerTest extends TestCase
$repository->shouldReceive('setUser')->once();
$accountRepos->shouldReceive('setUser')->once();
$currencyRepos->shouldReceive('setUser')->once();
$repository->shouldReceive('getConfiguration')->andReturn($config)->times(2);
$repository->shouldReceive('getConfiguration')->andReturn($config)->times(3);
$repository->shouldReceive('setConfiguration')->withArgs([Mockery::any(), $expected])->once();
$accountRepos->shouldReceive('findNull')->withArgs([456])->andReturn(new Account)->once();
@@ -192,6 +193,7 @@ class ChooseAccountsHandlerTest extends TestCase
];
$expected = $config;
$expected['mapping'][0] = 456;
$expected['bunq-iban'] = [];
// mock stuff
$repository = $this->mock(ImportJobRepositoryInterface::class);
@@ -202,7 +204,7 @@ class ChooseAccountsHandlerTest extends TestCase
$repository->shouldReceive('setUser')->once();
$accountRepos->shouldReceive('setUser')->once();
$currencyRepos->shouldReceive('setUser')->once();
$repository->shouldReceive('getConfiguration')->andReturn($config)->times(2);
$repository->shouldReceive('getConfiguration')->andReturn($config)->times(3);
$repository->shouldReceive('setConfiguration')->withArgs([Mockery::any(), $expected])->once();
$accountRepos->shouldReceive('findNull')->withArgs([456])->andReturn(new Account)->once();
@@ -246,6 +248,7 @@ class ChooseAccountsHandlerTest extends TestCase
];
$expected = $config;
$expected['mapping'][1234] = 0;
$expected['bunq-iban'] = [];
// mock stuff
$repository = $this->mock(ImportJobRepositoryInterface::class);
@@ -256,7 +259,7 @@ class ChooseAccountsHandlerTest extends TestCase
$repository->shouldReceive('setUser')->once();
$accountRepos->shouldReceive('setUser')->once();
$currencyRepos->shouldReceive('setUser')->once();
$repository->shouldReceive('getConfiguration')->andReturn($config)->times(2);
$repository->shouldReceive('getConfiguration')->andReturn($config)->times(3);
$repository->shouldReceive('setConfiguration')->withArgs([Mockery::any(), $expected])->once();
$accountRepos->shouldReceive('findNull')->withArgs([456])->andReturnNull()->once();
@@ -291,7 +294,6 @@ class ChooseAccountsHandlerTest extends TestCase
0 => ['id' => 1234, 'name' => 'bunq'],
],
'apply-rules' => true,
];
// mock stuff