-
Notifications
You must be signed in to change notification settings - Fork 50
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
Improve random customers data #95
base: trunk
Are you sure you want to change the base?
Improve random customers data #95
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great! Thanks for the contribution!
wp wc generate customers 10
wp wc generate customers 10 --email-domain=foo-bar.com
I do expect some merge conflicts with #80, though.
I'll forward this internally to see if we can get it merged soon.
$domain = ''; | ||
|
||
if ( ! empty( $assoc_args['email-domain'] ) ) { | ||
$domain = $assoc_args['email-domain']; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be consolidated to one line:
$domain = ''; | |
if ( ! empty( $assoc_args['email-domain'] ) ) { | |
$domain = $assoc_args['email-domain']; | |
} | |
$domain = $assoc_args['email-domain'] ?? ''; |
do { | ||
$username = self::$faker->userName(); | ||
} while ( username_exists( $username ) ); | ||
$safeEmailDomain = $emailDomain ? $emailDomain : self::$faker->safeEmailDomain(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second instance of the variable is redundant.
$safeEmailDomain = $emailDomain ? $emailDomain : self::$faker->safeEmailDomain(); | |
$safeEmailDomain = $emailDomain ?: self::$faker->safeEmailDomain(); |
File conflicts from out of date files
Hi @LuigiPulcini, Apologies not getting to this sooner. It looks like there are some conflicts now. Would you mind resolving those so that we can give this a re-review? |
All Submissions:
Changes proposed in this Pull Request:
This Pull Request contains two main enhancements:
--email-domain=passeddomain.com
, all the customers will have their email addresses in the format[email protected]
. This is vital for email testing where, for example, an external server could be used to verify the delivery of test emails (e.g. email.ghostinspector.com). If no email domain name is passed, the customers' email addresses will have their domain name randomly generated by$faker->safeEmailDomain()
John
, last nameDoe
, usernamekaren.white
, email address[email protected]
). This leads to a certain degree of confusion when it comes to testing certain features. With the proposed change, all the user data will be unequivocally matching (e.g. first nameJohn
, last nameDoe
, usernamejohn.doe
, email address[email protected]
or[email protected]
when an email domain is passed).How to test the changes in this Pull Request:
wp wc generate customers 10 --email-domain=passed-domain.com
--email-domain
parameter.Other information:
Changelog entry
FOR PR REVIEWER ONLY: