-
-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathUserModelTest.php
More file actions
40 lines (29 loc) · 1.14 KB
/
UserModelTest.php
File metadata and controls
40 lines (29 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class UserModelTest extends TestCase
{
use RefreshDatabase;
public function test_get_filament_name_returns_name_when_present(): void
{
$user = User::factory()->create(['name' => 'John Doe']);
$this->assertSame('John Doe', $user->getFilamentName());
}
public function test_get_filament_name_returns_display_name_when_name_is_null(): void
{
$user = User::factory()->create(['name' => null, 'display_name' => 'Custom Name']);
$this->assertSame('Custom Name', $user->getFilamentName());
}
public function test_get_filament_name_returns_email_when_name_and_display_name_are_null(): void
{
$user = User::factory()->create(['name' => null, 'display_name' => null]);
$this->assertSame($user->email, $user->getFilamentName());
}
public function test_get_filament_name_always_returns_string(): void
{
$user = User::factory()->create(['name' => null, 'display_name' => null]);
$this->assertIsString($user->getFilamentName());
}
}