Warn about expensive code in test environment.

This commit is contained in:
James Cole
2019-06-22 10:25:57 +02:00
parent 0f70cc5780
commit 2710a30a7c
15 changed files with 328 additions and 127 deletions

View File

@@ -34,7 +34,7 @@ use Laravel\Passport\Passport;
use Log;
use Preferences;
use Tests\TestCase;
use Amount;
/**
* Class CurrencyControllerTest
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -65,7 +65,7 @@ class CurrencyControllerTest extends TestCase
$currency = TransactionCurrency::first();
$repository = $this->mock(CurrencyRepositoryInterface::class);
$transformer = $this->mock(CurrencyTransformer::class);
$userRepository = $this->mock(UserRepositoryInterface::class);
$this->mock(UserRepositoryInterface::class);
// mock transformer
$transformer->shouldReceive('setParameters')->withAnyArgs()->atLeast()->once();
@@ -74,6 +74,9 @@ class CurrencyControllerTest extends TestCase
$transformer->shouldReceive('getAvailableIncludes')->withAnyArgs()->atLeast()->once()->andReturn([]);
$transformer->shouldReceive('transform')->atLeast()->once()->andReturn(['id' => 5]);
// mock facades.
Amount::shouldReceive('getDefaultCurrencyByUser')->atLeast()->once()->andReturn($currency);
// mock calls:
$repository->shouldReceive('setUser')->once();
$repository->shouldReceive('store')->andReturn($currency);