diff --git a/database/factories/LocationFactory.php b/database/factories/LocationFactory.php index ef90f006a9..62afd25d03 100644 --- a/database/factories/LocationFactory.php +++ b/database/factories/LocationFactory.php @@ -1,36 +1,12 @@ $this->faker->city, - 'address' => $this->faker->streetAddress, - 'address2' => $this->faker->secondaryAddress, - 'city' => $this->faker->city, - 'state' => $this->faker->stateAbbr, - 'country' => $this->faker->countryCode, - 'currency' => $this->faker->currencyCode, - 'zip' => $this->faker->postcode, + 'name' => $this->faker->city(), + 'address' => $this->faker->streetAddress(), + 'address2' => $this->faker->secondaryAddress(), + 'city' => $this->faker->city(), + 'state' => $this->faker->stateAbbr(), + 'country' => $this->faker->countryCode(), + 'currency' => $this->faker->currencyCode(), + 'zip' => $this->faker->postcode(), 'image' => rand(1, 9).'.jpg', + ]; } + } diff --git a/tests/TestCase.php b/tests/TestCase.php index e849640102..2932d4a69d 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,40 +1,10 @@ make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); - return $app; - } - - - public function setUp() : void - { - parent::setUp(); - \Artisan::call('migrate:fresh'); - $this->seed(); - } - - public function tearDown() : void - { - //Artisan::call('migrate:reset'); - parent::tearDown(); - } -} \ No newline at end of file + use CreatesApplication; +} diff --git a/tests/unit/BaseTest.php b/tests/unit/BaseTest.php index 9ad3fb213f..c30ef4b910 100644 --- a/tests/unit/BaseTest.php +++ b/tests/unit/BaseTest.php @@ -5,7 +5,7 @@ use App\Models\User; use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\WithoutMiddleware; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; class BaseTest extends TestCase { diff --git a/tests/unit/LocationTest.php b/tests/unit/LocationTest.php index d4739e1a31..30cc8f98fc 100644 --- a/tests/unit/LocationTest.php +++ b/tests/unit/LocationTest.php @@ -2,10 +2,9 @@ namespace Tests\Unit; use App\Models\Location; -use Illuminate\Foundation\Testing\DatabaseMigrations; -use Illuminate\Foundation\Testing\DatabaseTransactions; -use Illuminate\Foundation\Testing\WithoutMiddleware; use Tests\Unit\BaseTest; +use Illuminate\Database\Eloquent\Factories\Factory; +use Tests\TestCase; class LocationTest extends BaseTest { @@ -36,6 +35,6 @@ class LocationTest extends BaseTest ]); $this->assertFalse($a->isValid()); - $this->assertStringContainsString('The parent id and id must be different', $a->getErrors()); + $this->assertStringContainsString(trans('validation.non_circular', ['attribute' => 'parent id']), $a->getErrors()); } }