diff --git a/composer.json b/composer.json index 2fb1dd6..9c1c303 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ }, "require": { "php": "^8.0", - "illuminate/support": "^9.0|^10.0|^11.0" + "illuminate/support": "^9.5|^10.0|^11.0" }, "prefer-stable": true, "require-dev": { diff --git a/tests/Feature/LoginFeatureTest.php b/tests/Feature/LoginFeatureTest.php index e4ad790..4c7438a 100644 --- a/tests/Feature/LoginFeatureTest.php +++ b/tests/Feature/LoginFeatureTest.php @@ -5,10 +5,7 @@ use Carbon\Carbon; use Illuminate\Routing\Exceptions\InvalidSignatureException; use Illuminate\Support\Arr; -use Illuminate\Support\Facades\Hash; -use Illuminate\Support\Str; use NorbyBaru\Passwordless\Facades\Passwordless; -use NorbyBaru\Passwordless\Tests\Fixtures\Models\User as UserModel; use NorbyBaru\Passwordless\Tests\TestCase; class LoginFeatureTest extends TestCase @@ -19,14 +16,6 @@ public function setUp(): void { parent::setUp(); - $this->user = UserModel::create([ - 'name' => $this->faker->name, - 'email' => $this->faker->unique()->safeEmail, - 'email_verified_at' => now(), - 'password' => Hash::make(Str::random(10)), - 'remember_token' => Str::random(10), - ]); - $token = Passwordless::magicLink()->createToken($this->user); $this->signedUrl = Passwordless::magicLink()->generateUrl($this->user, $token); } diff --git a/tests/Feature/MagicLinkFeatureTest.php b/tests/Feature/MagicLinkFeatureTest.php index 0366f2e..1f7f127 100644 --- a/tests/Feature/MagicLinkFeatureTest.php +++ b/tests/Feature/MagicLinkFeatureTest.php @@ -4,7 +4,6 @@ use Illuminate\Support\Arr; use Illuminate\Support\Carbon; -use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Notification; use Illuminate\Support\Str; use NorbyBaru\Passwordless\Facades\Passwordless; @@ -15,21 +14,6 @@ class MagicLinkFeatureTest extends TestCase { - protected UserModel $user; - - public function setUp(): void - { - parent::setUp(); - - $this->user = UserModel::create([ - 'name' => $this->faker->name, - 'email' => $this->faker->unique()->safeEmail, - 'email_verified_at' => now(), - 'password' => Hash::make(Str::random(10)), - 'remember_token' => Str::random(10), - ]); - } - public function test_it_can_generate_magic_link() { $token = Passwordless::magicLink()->createToken($this->user); diff --git a/tests/TestCase.php b/tests/TestCase.php index 14bdfc0..08d42e9 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -4,9 +4,12 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\WithFaker; +use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Notification; +use Illuminate\Support\Str; use NorbyBaru\Passwordless\PasswordlessServiceProvider; use NorbyBaru\Passwordless\Tests\Fixtures\Models\User; +use NorbyBaru\Passwordless\Tests\Fixtures\Models\User as UserModel; use Orchestra\Testbench\TestCase as OrchestraTestCase; abstract class TestCase extends OrchestraTestCase @@ -14,11 +17,21 @@ abstract class TestCase extends OrchestraTestCase use RefreshDatabase; use WithFaker; + protected UserModel $user; + public function setUp(): void { parent::setUp(); $this->setUpFaker(); Notification::fake(); + + $this->user = UserModel::create([ + 'name' => $this->faker->name, + 'email' => $this->faker->unique()->safeEmail, + 'email_verified_at' => now(), + 'password' => Hash::make(Str::random(10)), + 'remember_token' => Str::random(10), + ]); } /**