Files
solidtime/tests/Feature/ProfileInformationTest.php
2024-03-19 19:11:36 +01:00

34 lines
832 B
PHP

<?php
declare(strict_types=1);
namespace Tests\Feature;
use App\Models\User;
use App\Service\TimezoneService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ProfileInformationTest extends TestCase
{
use RefreshDatabase;
public function test_profile_information_can_be_updated(): void
{
// Arrange
$user = User::factory()->create();
$this->actingAs($user);
// Act
$response = $this->put('/user/profile-information', [
'name' => 'Test Name',
'email' => 'test@example.com',
'timezone' => app(TimezoneService::class)->getTimezones()[0],
]);
// Assert
$this->assertEquals('Test Name', $user->fresh()->name);
$this->assertEquals('test@example.com', $user->fresh()->email);
}
}