Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
norbybaru committed Apr 4, 2024
1 parent 98a4234 commit de8bd37
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 28 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
11 changes: 0 additions & 11 deletions tests/Feature/LoginFeatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
Expand Down
16 changes: 0 additions & 16 deletions tests/Feature/MagicLinkFeatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
13 changes: 13 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,34 @@

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
{
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),
]);
}

/**
Expand Down

0 comments on commit de8bd37

Please sign in to comment.