Add profile avatar uploads
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace Tests\Feature\Auth;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Laravel\Fortify\Features;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -26,6 +28,8 @@ class RegistrationTest extends TestCase
|
||||
|
||||
public function test_new_users_can_register()
|
||||
{
|
||||
Storage::fake('public');
|
||||
|
||||
$response = $this->post(route('register.store'), [
|
||||
'name' => 'Test User',
|
||||
'email' => 'test@example.com',
|
||||
@@ -35,5 +39,14 @@ class RegistrationTest extends TestCase
|
||||
|
||||
$this->assertAuthenticated();
|
||||
$response->assertRedirect(route('dashboard', absolute: false));
|
||||
|
||||
$user = User::query()->where('email', 'test@example.com')->firstOrFail();
|
||||
|
||||
$this->assertTrue($user->avatar_is_generated);
|
||||
$this->assertNotNull($user->avatar_color);
|
||||
$this->assertNotNull($user->avatar_path);
|
||||
|
||||
Storage::disk('public')->assertExists($user->avatar_path);
|
||||
$this->assertStringContainsString('TU', Storage::disk('public')->get($user->avatar_path));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user