Create test user accounts in controller with faker data

I need to create a lot of account information for testing my app.

I am creating a test controller that I can call to add some number of user accounts ( 10 or 20 per call ).

Generating the test data with faker is no problem, but I am not sure how I can create a "proper" and functioning user account.

I am using the dektrium/yii2-user library.

I need to be able to add accounts without user intervention or verification.



dektrium/yii2-user provides a handy utility for adding and confirming users

Hi alirz23,

I saw that command line function, but I needed a way to add users from a controller action.

If I only needed to add a few, that would work fine, but I need to add thousands…

I finally solved it after looking at the migrations that come with the dektrium/yii2-user package.

The migration showed me how to populate fields to create a functional user.

It is working great now.