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

This commit is contained in:
James Cole
2018-09-04 09:52:19 +02:00
parent 46ba0a5a5a
commit 07edbe758a
111 changed files with 1524 additions and 98 deletions

View File

@@ -39,7 +39,7 @@ class AuthenticateTest extends TestCase
public function setUp(): void
{
parent::setUp();
Log::info(sprintf('Now in %s.', \get_class($this)));
Route::middleware('auth')->any(
'/_test/authenticate', function () {
return 'OK';

View File

@@ -29,6 +29,7 @@ use Preferences;
use Route;
use Symfony\Component\HttpFoundation\Response;
use Tests\TestCase;
use Log;
/**
* Class AuthenticateTwoFactorTest
@@ -41,7 +42,7 @@ class AuthenticateTwoFactorTest extends TestCase
public function setUp(): void
{
parent::setUp();
Log::info(sprintf('Now in %s.', \get_class($this)));
Route::middleware(AuthenticateTwoFactor::class)->any(
'/_test/authenticate', function () {
return 'OK';

View File

@@ -32,6 +32,7 @@ use Illuminate\Support\Collection;
use Route;
use Symfony\Component\HttpFoundation\Response;
use Tests\TestCase;
use Log;
/**
* Class BinderTest
@@ -51,6 +52,7 @@ class BinderTest extends TestCase
return 'OK';
}
);
Log::info(sprintf('Now in %s.', \get_class($this)));
$this->be($this->user());
$response = $this->get('/_test/binder/1');

View File

@@ -27,6 +27,7 @@ use FireflyIII\Http\Middleware\IsAdmin;
use Route;
use Symfony\Component\HttpFoundation\Response;
use Tests\TestCase;
use Log;
/**
* Class IsAdminTest
@@ -39,12 +40,13 @@ class IsAdminTest extends TestCase
public function setUp(): void
{
parent::setUp();
Log::info(sprintf('Now in %s.', \get_class($this)));
Route::middleware(IsAdmin::class)->any(
'/_test/is-admin', function () {
return 'OK';
}
);
}
/**

View File

@@ -28,6 +28,7 @@ use FireflyIII\Http\Middleware\StartFireflySession;
use Route;
use Symfony\Component\HttpFoundation\Response;
use Tests\TestCase;
use Log;
/**
* Class IsDemoUserTest
@@ -40,7 +41,7 @@ class IsDemoUserTest extends TestCase
public function setUp(): void
{
parent::setUp();
Log::info(sprintf('Now in %s.', \get_class($this)));
Route::middleware([StartFireflySession::class, IsDemoUser::class])->any(
'/_test/is-demo', function () {
return 'OK';

View File

@@ -27,6 +27,7 @@ use FireflyIII\Http\Middleware\IsSandStormUser;
use Route;
use Symfony\Component\HttpFoundation\Response;
use Tests\TestCase;
use Log;
/**
* Class IsSandstormUserTest
@@ -39,7 +40,7 @@ class IsSandstormUserTest extends TestCase
public function setUp(): void
{
parent::setUp();
Log::info(sprintf('Now in %s.', \get_class($this)));
Route::middleware(IsSandStormUser::class)->any(
'/_test/is-sandstorm', function () {
return 'OK';

View File

@@ -29,6 +29,7 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use Route;
use Symfony\Component\HttpFoundation\Response;
use Tests\TestCase;
use Log;
/**
* Class RangeTest
@@ -41,7 +42,7 @@ class RangeTest extends TestCase
public function setUp(): void
{
parent::setUp();
Log::info(sprintf('Now in %s.', \get_class($this)));
Route::middleware(Range::class)->any(
'/_test/range', function () {
return view('test.test');

View File

@@ -29,7 +29,7 @@ use Preferences;
use Route;
use Symfony\Component\HttpFoundation\Response;
use Tests\TestCase;
use Log;
/**
* Class RedirectIf2FAAuthenticatedTest
*/
@@ -41,7 +41,7 @@ class RedirectIf2FAAuthenticatedTest extends TestCase
public function setUp(): void
{
parent::setUp();
Log::info(sprintf('Now in %s.', \get_class($this)));
Route::middleware(RedirectIfTwoFactorAuthenticated::class)->any(
'/_test/authenticate', function () {
return 'OK';

View File

@@ -27,6 +27,7 @@ use FireflyIII\Http\Middleware\RedirectIfAuthenticated;
use Route;
use Symfony\Component\HttpFoundation\Response;
use Tests\TestCase;
use Log;
/**
* Class RedirectIfAuthenticatedTest
@@ -39,7 +40,7 @@ class RedirectIfAuthenticatedTest extends TestCase
public function setUp(): void
{
parent::setUp();
Log::info(sprintf('Now in %s.', \get_class($this)));
Route::middleware(RedirectIfAuthenticated::class)->any(
'/_test/authenticate', function () {
return 'OK';

View File

@@ -29,6 +29,7 @@ use Mockery;
use Route;
use Symfony\Component\HttpFoundation\Response;
use Tests\TestCase;
use Log;
/**
* Class RangeTest
@@ -41,7 +42,7 @@ class SandstormTest extends TestCase
public function setUp(): void
{
parent::setUp();
Log::info(sprintf('Now in %s.', \get_class($this)));
Route::middleware(Sandstorm::class)->any(
'/_test/sandstorm', function () {
return view('test.test');