選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

ProfileInformationTest.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Tests\Feature;
  3. use App\Models\User;
  4. use Illuminate\Foundation\Testing\RefreshDatabase;
  5. use Livewire\Livewire;
  6. use Tests\TestCase;
  7. use Wallo\FilamentCompanies\Http\Livewire\UpdateProfileInformationForm;
  8. class ProfileInformationTest extends TestCase
  9. {
  10. use RefreshDatabase;
  11. public function test_current_profile_information_is_available(): void
  12. {
  13. $this->actingAs($user = User::factory()->create());
  14. $component = Livewire::test(UpdateProfileInformationForm::class);
  15. $this->assertEquals($user->name, $component->state['name']);
  16. $this->assertEquals($user->email, $component->state['email']);
  17. }
  18. public function test_profile_information_can_be_updated(): void
  19. {
  20. $this->actingAs($user = User::factory()->create());
  21. Livewire::test(UpdateProfileInformationForm::class)
  22. ->set('state', ['name' => 'Test Name', 'email' => 'test@example.com'])
  23. ->call('updateProfileInformation');
  24. $this->assertEquals('Test Name', $user->fresh()->name);
  25. $this->assertEquals('test@example.com', $user->fresh()->email);
  26. }
  27. }