Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

luadotsh/lua

324 stars
1 code files
View luadotsh/lua on GitHub

tests/Feature/App/AccountTest.php

Open in GitHub
use App\Models\User;
use function Pest\Laravel\actingAs;
use Illuminate\Foundation\Testing\RefreshDatabase;
 
uses(RefreshDatabase::class);
 
beforeEach(function () {
$this->user = User::factory()->withWorkspace()->create();
});
 
test('profile page is displayed', function () {
actingAs($this->user)
->get(route('setting.account.edit'))
->assertOk();
});
 
test('profile information can be updated', function () {
actingAs($this->user)
->from(route('setting.account.edit'))
->post(route('setting.account.update'), [
'name' => 'Test User',
'email' => '[email protected]',
'theme' => $this->user->theme->value
])
->assertSessionHasNoErrors()
->assertRedirect(route('setting.account.edit'));
 
$this->user->refresh();
 
expect($this->user->name)->toBe('Test User')
->and($this->user->email)->toBe('[email protected]')
->and($this->user->email_verified_at)->toBeNull();
});
 
test('email verification status is unchanged when email address is unchanged', function () {
actingAs($this->user)
->from(route('setting.account.edit'))
->post(route('setting.account.update'), [
'name' => 'Test User',
'email' => $this->user->email,
'theme' => $this->user->theme->value
])
->assertSessionHasNoErrors()
->assertRedirect(route('setting.account.edit'));
 
$this->user->refresh();
 
expect($this->user->email_verified_at)->not->toBeNull();
});

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.