Skip to content

Conversation

@coreymckrill
Copy link
Contributor

@coreymckrill coreymckrill commented Jan 3, 2025

Changes proposed in this Pull Request:

This consolidates the steps that each generator class needs to take before generating objects into one initialize method. These steps include creating an instance of the Faker library and unhooking all the callbacks that send transactional emails. This ensures that the emails are disabled regardless of which entrypoint to Smooth Generator is used (cli or web UI).

Fixes #140

How to test the changes in this Pull Request:

  1. Install an email catcher plugin like WP Mail Logging so you can see the outgoing emails from your test site.
  2. Replicate the issue on trunk first: try generating some products and/or orders, particularly using the web UI rather than wp-cli (WP Admin > Tools > Smooth Generator). Note that emails have been sent about low/no stock when generating some orders, and that emails have been sent about order statuses when generating orders.
  3. Now check out this branch and try again. This time there shouldn't be any emails sent.
  4. Also try generating things from wp-cli to make sure there aren't any regressions.

Changelog entry

Ensure transactional emails are disabled before generating test content.

This consolidates the steps that each generator class needs to take
before generating objects into one `initialize` method. These steps
include creating an instance of the Faker library and unhooking all the
callbacks that send transactional emails. This ensures that the emails
are disabled regardless of which entrypoint to Smooth Generator is used
(cli or web UI).

Fixes #140
@coreymckrill coreymckrill self-assigned this Jan 3, 2025
@coreymckrill coreymckrill marked this pull request as ready for review January 3, 2025 22:31
Copy link
Member

@jorgeatorres jorgeatorres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @coreymckrill! This works great. Just left some comments about protected static usage. Let me know what you think.

@jorgeatorres jorgeatorres self-requested a review January 10, 2025 13:20
Copy link
Member

@jorgeatorres jorgeatorres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you @coreymckrill!

@jorgeatorres jorgeatorres merged commit e2ae6f4 into trunk Jan 10, 2025
@jorgeatorres jorgeatorres deleted the fix/140/disable-emails branch January 10, 2025 13:22
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.

Don't send any emails during item generation

3 participants