Skip to content

Get fresh user instance on two factor authentication tests #1281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2023

Conversation

telkins
Copy link
Contributor

@telkins telkins commented Mar 18, 2023

In my installation, these tests fail because the user doesn't have the two_factor_confirmed_at attribute:

The attribute [two_factor_confirmed_at] either does not exist or was not retrieved for model [App\Models\User]. (View: /var/www/html/vendor/livewire/livewire/src/views/mount-component.blade.php)

I believe this is because the factory doesn't specify the attribute.

I considered updating the factory to include it (set to null), but then I thought it might be a little messy because there should be a check to see if the feature's enabled.

This solution, however, requires everyone to remember to get a fresh user instance, when needed, without it being clear as to why.

So...let me know if I should try a different approach...

Unverified

This user has not yet uploaded their public signing key.
In my installation, these tests fail because the user doesn't have the `two_factor_confirmed_at` attribute:
```
The attribute [two_factor_confirmed_at] either does not exist or was not retrieved for model [App\Models\User]. (View: /var/www/html/vendor/livewire/livewire/src/views/mount-component.blade.php)
```

I believe this is because the factory doesn't specify the attribute.

I considered updating the factory to include it (set to `null`), but then I thought it might be a little messy because there should be a check to see if the feature's enabled.

This solution, however, requires everyone to remember to get a fresh user instance, when needed, without it being clear as to why.

So...let me know if I should try a different approach...
@taylorotwell taylorotwell merged commit 1291d7f into laravel:3.x Mar 18, 2023
@taylorotwell
Copy link
Member

I assume this is because you're using some of Eloquent's strict features?

@telkins telkins deleted the patch-3 branch March 18, 2023 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants