mirror of https://github.com/kcal-app/kcal.git
Move database refresh to base TestCase
This commit is contained in:
parent
260a57dc52
commit
0836e3ecf3
|
|
@ -21,14 +21,16 @@
|
||||||
<server name="APP_ENV" value="testing"/>
|
<server name="APP_ENV" value="testing"/>
|
||||||
<server name="BCRYPT_ROUNDS" value="4"/>
|
<server name="BCRYPT_ROUNDS" value="4"/>
|
||||||
<server name="CACHE_DRIVER" value="array"/>
|
<server name="CACHE_DRIVER" value="array"/>
|
||||||
<server name="DB_CONNECTION" value="sqlite"/>
|
|
||||||
<server name="DB_DATABASE" value=":memory:"/>
|
|
||||||
<server name="MAIL_MAILER" value="array"/>
|
<server name="MAIL_MAILER" value="array"/>
|
||||||
<server name="QUEUE_CONNECTION" value="sync"/>
|
<server name="QUEUE_CONNECTION" value="sync"/>
|
||||||
<server name="SESSION_DRIVER" value="elastic"/>
|
<server name="SESSION_DRIVER" value="elastic"/>
|
||||||
<server name="SESSION_DRIVER" value="array"/>
|
<server name="SESSION_DRIVER" value="array"/>
|
||||||
<server name="TELESCOPE_ENABLED" value="false"/>
|
<server name="TELESCOPE_ENABLED" value="false"/>
|
||||||
|
|
||||||
|
<!-- @todo Figure out how to do MySQL parallel testing inside Sail. -->
|
||||||
|
<server name="DB_CONNECTION" value="sqlite"/>
|
||||||
|
<server name="DB_DATABASE" value=":memory:"/>
|
||||||
|
|
||||||
<!-- Configuration below assumes tests are running from Sail. -->
|
<!-- Configuration below assumes tests are running from Sail. -->
|
||||||
<server name="ELASTIC_HOST" value="elasticsearch:9200"/>
|
<server name="ELASTIC_HOST" value="elasticsearch:9200"/>
|
||||||
</php>
|
</php>
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,10 @@
|
||||||
namespace Tests\Feature\Console;
|
namespace Tests\Feature\Console;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class UserAddTest extends TestCase
|
class UserAddTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
|
||||||
|
|
||||||
public function testCanAddUserInteractively(): void
|
public function testCanAddUserInteractively(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,11 @@ namespace Tests\Feature\Http\Controllers\Auth;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Providers\RouteServiceProvider;
|
use App\Providers\RouteServiceProvider;
|
||||||
use Illuminate\Auth\Events\Lockout;
|
use Illuminate\Auth\Events\Lockout;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use Illuminate\Validation\ValidationException;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class AuthenticationTest extends TestCase
|
class AuthenticationTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
|
||||||
|
|
||||||
public function testLoginScreenCanRendered(): void
|
public function testLoginScreenCanRendered(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,9 @@ namespace Tests\Feature\Http\Controllers;
|
||||||
use App\Http\Controllers\FoodController;
|
use App\Http\Controllers\FoodController;
|
||||||
use App\Models\Food;
|
use App\Models\Food;
|
||||||
use Database\Factories\FoodFactory;
|
use Database\Factories\FoodFactory;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
|
|
||||||
class FoodControllerTest extends HttpControllerTestCase
|
class FoodControllerTest extends HttpControllerTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,9 @@ namespace Tests\Feature\Http\Controllers;
|
||||||
use App\Http\Controllers\GoalController;
|
use App\Http\Controllers\GoalController;
|
||||||
use App\Models\Goal;
|
use App\Models\Goal;
|
||||||
use Database\Factories\GoalFactory;
|
use Database\Factories\GoalFactory;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
|
|
||||||
class GoalControllerTest extends HttpControllerTestCase
|
class GoalControllerTest extends HttpControllerTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ use App\Http\Controllers\IngredientPickerController;
|
||||||
use App\Models\Food;
|
use App\Models\Food;
|
||||||
use App\Models\Recipe;
|
use App\Models\Recipe;
|
||||||
use GuzzleHttp\Exception\ConnectException;
|
use GuzzleHttp\Exception\ConnectException;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
use Tests\LoggedInTestCase;
|
use Tests\LoggedInTestCase;
|
||||||
|
|
||||||
|
|
@ -15,7 +14,6 @@ use Tests\LoggedInTestCase;
|
||||||
*/
|
*/
|
||||||
class IngredientPickerControllerTest extends LoggedInTestCase
|
class IngredientPickerControllerTest extends LoggedInTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
|
||||||
|
|
||||||
private function buildUrl(array $parameters = []): string
|
private function buildUrl(array $parameters = []): string
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,11 @@ use App\Http\Controllers\JournalEntryController;
|
||||||
use App\Models\IngredientAmount;
|
use App\Models\IngredientAmount;
|
||||||
use App\Models\JournalEntry;
|
use App\Models\JournalEntry;
|
||||||
use Database\Factories\JournalEntryFactory;
|
use Database\Factories\JournalEntryFactory;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Illuminate\Foundation\Testing\WithFaker;
|
use Illuminate\Foundation\Testing\WithFaker;
|
||||||
|
|
||||||
class JournalEntryControllerTest extends HttpControllerTestCase
|
class JournalEntryControllerTest extends HttpControllerTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase, WithFaker;
|
use WithFaker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,12 @@ use App\Models\RecipeSeparator;
|
||||||
use App\Models\RecipeStep;
|
use App\Models\RecipeStep;
|
||||||
use Database\Factories\RecipeFactory;
|
use Database\Factories\RecipeFactory;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Illuminate\Foundation\Testing\WithFaker;
|
use Illuminate\Foundation\Testing\WithFaker;
|
||||||
use Illuminate\Http\UploadedFile;
|
use Illuminate\Http\UploadedFile;
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
|
|
||||||
class RecipeControllerTest extends HttpControllerTestCase
|
class RecipeControllerTest extends HttpControllerTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase, WithFaker;
|
use WithFaker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,13 @@
|
||||||
namespace Tests\Feature\JsonApi;
|
namespace Tests\Feature\JsonApi;
|
||||||
|
|
||||||
use App\Models\Food;
|
use App\Models\Food;
|
||||||
use App\Models\Recipe;
|
|
||||||
use Database\Factories\FoodFactory;
|
use Database\Factories\FoodFactory;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Tests\Feature\JsonApi\Traits\HasTags;
|
use Tests\Feature\JsonApi\Traits\HasTags;
|
||||||
|
|
||||||
class FoodApiTest extends JsonApiTestCase
|
class FoodApiTest extends JsonApiTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase, HasTags;
|
use HasTags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,12 @@ namespace Tests\Feature\JsonApi;
|
||||||
use App\Models\Goal;
|
use App\Models\Goal;
|
||||||
use Database\Factories\GoalFactory;
|
use Database\Factories\GoalFactory;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Tests\Feature\JsonApi\Traits\BelongsToUser;
|
use Tests\Feature\JsonApi\Traits\BelongsToUser;
|
||||||
|
|
||||||
class GoalApiTest extends JsonApiTestCase
|
class GoalApiTest extends JsonApiTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase, BelongsToUser;
|
use BelongsToUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,9 @@ use App\Models\IngredientAmount;
|
||||||
use App\Models\JournalEntry;
|
use App\Models\JournalEntry;
|
||||||
use App\Models\Recipe;
|
use App\Models\Recipe;
|
||||||
use Database\Factories\IngredientAmountFactory;
|
use Database\Factories\IngredientAmountFactory;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
|
|
||||||
class IngredientAmountApiTest extends JsonApiTestCase
|
class IngredientAmountApiTest extends JsonApiTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,11 @@ namespace Tests\Feature\JsonApi;
|
||||||
use App\Models\JournalEntry;
|
use App\Models\JournalEntry;
|
||||||
use Database\Factories\JournalEntryFactory;
|
use Database\Factories\JournalEntryFactory;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Tests\Feature\JsonApi\Traits\BelongsToUser;
|
use Tests\Feature\JsonApi\Traits\BelongsToUser;
|
||||||
|
|
||||||
class JournalEntryApiTest extends JsonApiTestCase
|
class JournalEntryApiTest extends JsonApiTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase, BelongsToUser;
|
use BelongsToUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,9 @@ namespace Tests\Feature\JsonApi;
|
||||||
use App\Models\Recipe;
|
use App\Models\Recipe;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
|
|
||||||
class MediumApiTest extends JsonApiTestCase
|
class MediumApiTest extends JsonApiTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,11 @@ namespace Tests\Feature\JsonApi;
|
||||||
|
|
||||||
use App\Models\Recipe;
|
use App\Models\Recipe;
|
||||||
use Database\Factories\RecipeFactory;
|
use Database\Factories\RecipeFactory;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Tests\Feature\JsonApi\Traits\HasTags;
|
use Tests\Feature\JsonApi\Traits\HasTags;
|
||||||
|
|
||||||
class RecipeApiTest extends JsonApiTestCase
|
class RecipeApiTest extends JsonApiTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase, HasTags;
|
use HasTags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,11 @@ use App\Models\Recipe;
|
||||||
use App\Models\RecipeSeparator;
|
use App\Models\RecipeSeparator;
|
||||||
use Database\Factories\RecipeSeparatorFactory;
|
use Database\Factories\RecipeSeparatorFactory;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Tests\Feature\JsonApi\Traits\BelongsToRecipe;
|
use Tests\Feature\JsonApi\Traits\BelongsToRecipe;
|
||||||
|
|
||||||
class RecipeSeparatorApiTest extends JsonApiTestCase
|
class RecipeSeparatorApiTest extends JsonApiTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase, BelongsToRecipe;
|
use BelongsToRecipe;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,11 @@ use App\Models\Recipe;
|
||||||
use App\Models\RecipeStep;
|
use App\Models\RecipeStep;
|
||||||
use Database\Factories\RecipeStepFactory;
|
use Database\Factories\RecipeStepFactory;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Tests\Feature\JsonApi\Traits\BelongsToRecipe;
|
use Tests\Feature\JsonApi\Traits\BelongsToRecipe;
|
||||||
|
|
||||||
class RecipeStepApiTest extends JsonApiTestCase
|
class RecipeStepApiTest extends JsonApiTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase, BelongsToRecipe;
|
use BelongsToRecipe;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,9 @@ namespace Tests\Feature\JsonApi;
|
||||||
|
|
||||||
use App\Models\Tag;
|
use App\Models\Tag;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
|
|
||||||
class TagApiTest extends JsonApiTestCase
|
class TagApiTest extends JsonApiTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,9 @@ namespace Tests\Feature\JsonApi;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Database\Factories\UserFactory;
|
use Database\Factories\UserFactory;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
|
|
||||||
class UserApiTest extends JsonApiTestCase
|
class UserApiTest extends JsonApiTestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,10 @@ namespace Tests\Feature\Support;
|
||||||
|
|
||||||
use App\Models\Food;
|
use App\Models\Food;
|
||||||
use App\Support\Nutrients;
|
use App\Support\Nutrients;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class NutrientsTest extends TestCase
|
class NutrientsTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test invalid Food nutrient multiplier calculation.
|
* Test invalid Food nutrient multiplier calculation.
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,11 @@
|
||||||
|
|
||||||
namespace Tests;
|
namespace Tests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
||||||
|
|
||||||
abstract class TestCase extends BaseTestCase
|
abstract class TestCase extends BaseTestCase
|
||||||
{
|
{
|
||||||
use CreatesApplication;
|
use CreatesApplication;
|
||||||
|
use RefreshDatabase;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace Tests\Unit\Rules;
|
namespace Tests\Unit\Rules;
|
||||||
|
|
||||||
use App\Rules\ArrayNotEmpty;
|
use App\Rules\ArrayNotEmpty;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace Tests\Unit\Rules;
|
namespace Tests\Unit\Rules;
|
||||||
|
|
||||||
use App\Rules\InArray;
|
use App\Rules\InArray;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace Tests\Unit\Rules;
|
namespace Tests\Unit\Rules;
|
||||||
|
|
||||||
use App\Rules\StringIsDecimalOrFraction;
|
use App\Rules\StringIsDecimalOrFraction;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue