Update tests so repositories are not called. Saves on DB calls, speeds up tests.

This commit is contained in:
James Cole
2018-09-04 16:47:01 +02:00
parent ca04113aa7
commit d43fa3790d
23 changed files with 376 additions and 65 deletions

View File

@@ -87,6 +87,7 @@ class CurrencyControllerTest extends TestCase
$collection = TransactionCurrency::get();
// mock stuff:
$repository = $this->mock(CurrencyRepositoryInterface::class);
$userRepos = $this->mock(UserRepositoryInterface::class);
// mock calls:
$repository->shouldReceive('setUser')->once();
@@ -125,6 +126,7 @@ class CurrencyControllerTest extends TestCase
// create stuff
$currency = TransactionCurrency::first();
$repository = $this->mock(CurrencyRepositoryInterface::class);
$userRepos = $this->mock(UserRepositoryInterface::class);
// mock calls:
$repository->shouldReceive('setUser')->once();
@@ -152,6 +154,7 @@ class CurrencyControllerTest extends TestCase
$currency = TransactionCurrency::first();
$repository = $this->mock(CurrencyRepositoryInterface::class);
$userRepos = $this->mock(UserRepositoryInterface::class);
// mock calls:
$repository->shouldReceive('setUser')->once();
@@ -182,8 +185,10 @@ class CurrencyControllerTest extends TestCase
*/
public function testStoreWithDefault(): void
{
$currency = TransactionCurrency::first();
$repository = $this->mock(CurrencyRepositoryInterface::class);
$currency = TransactionCurrency::first();
$repository = $this->mock(CurrencyRepositoryInterface::class);
$userRepos = $this->mock(UserRepositoryInterface::class);
$preference = new Preference;
$preference->data = 'EUR';
// mock calls:
@@ -221,6 +226,7 @@ class CurrencyControllerTest extends TestCase
{
$currency = TransactionCurrency::first();
$repository = $this->mock(CurrencyRepositoryInterface::class);
$userRepos = $this->mock(UserRepositoryInterface::class);
// mock calls:
$repository->shouldReceive('setUser')->once();
@@ -253,6 +259,7 @@ class CurrencyControllerTest extends TestCase
{
$currency = TransactionCurrency::first();
$repository = $this->mock(CurrencyRepositoryInterface::class);
$userRepos = $this->mock(UserRepositoryInterface::class);
$preference = new Preference;
$preference->data = 'EUR';