I’m assuming your referring to a server based cron job. I’m not sure if your familiar with it but you could also use WP Cron. It’s an api that built into core. It’s a little easier to work with than a true cron job IMHO. It does have a mild caveat however. Which could also be it’s strength.
The scheduled events do not fire based on the servers internal clock alone. A user or a visitor of some sort needs to visit the site before any scheduled events are fired.
After the user / visitor visits WP Cron checks it’s timers and fires the ones that are due.
You could use this to your advantage in your phpunit tests. This could become even a more viable solution if you’re also using a headless browser such as selenium web driver http://docs.seleniumhq.org/ to test front end functionality as well as the backend.
Related Posts:
- Unit tests – Dealing with dependencies
- How to write testable classes in WordPress
- PHPUnit testing WordPress Plugin
- Implement phpunit testing on a plugin
- Unit testing to simulate the loop
- What is the best way to do unit tests for your plugin in 2018 [closed]
- Plugin development with unit tests
- Unit testing wordpress plugins with plugin options
- Install and load additional plugins when running unit tests
- PHPUnit test plugin activation
- Why is WP_Mock not used instead of WP_UnitTestCase for writing unit tests by most plugins?
- DataBase connection problem with PHPUnit and WordPress
- how to set context in WordPress for unit testing
- Unit testing a plugin with a theme dependency
- PHPUnit Testing and woocommerce Constant
- Unit Testing action hook
- PHPUnit Ajax Serialization of ‘Closure’ is not allowed
- PHPUnit Testing Installation Issue
- Plugin Form Submission Best Practice
- WP 3.3 How to Add Menu Items to the Admin Bar?
- Should I create a theme or a plugin?
- How to sync with plugins update after I have done manual optimizations?
- How to retrieve a value via get_option when the option_value is stored in a multi-dimensional array?
- How to change wordpress post title?
- add_meta_box() to Category Edit Screen?
- The changes I make to an external JS file of my WP plugin are only applied after I clear my browser’s cache
- How to properly load text domain of custom mu plugin
- How to add multiple copies of a widget from “available widgets”
- How to add quick edit and bulk edit fields to users admin section
- How do I approach removing menu items on the fly based on settings in my plugin?
- Can I use core’s “or Link to Existing Content” feature in my plugin?
- Plugin with specific admin menu icon
- What does $_registered_pages do?
- How do I change the initial quantity of a product in woocommerce?
- Redirect traffic to plugin
- Should I always prefer esc_attr_e & esc_html_e instead of _e?
- How to insert data to a database table when the field is not yet created?
- using new WP_Query in save_post function alters $post
- Preview Changes button missing on custom post type page since updating to 3.4
- Show special field when correct shipping is chosen
- Custom Taxonomy to dropdown box on adminside wordpress
- On cliking add new post redirect user to a custom page first
- How To Consistently Enforce Rewrite Rule in Plugin Development
- Warning: Cannot modify header information – How to resolve this issue? [closed]
- $paged always 0 on plugin’s custom page
- Create a new post using rest api and save featured image using an external image url
- wp.template() returns tags in Ajax response
- How to restrict access to image folder depending on whether product is purchased or not?
- Caching the_content calls
- Is there a way in which I can compare product id with the order id to display content on front end before placing the order? [closed]
- Video Security just like facebook [closed]
- How to hide or rename “X” and “x-child” references in website source?
- Link Pop-up in custom plugin
- How to handle shortcodes through plugin
- Run a function when new image is uploaded in media library
- Setting up Version Control for WordPress plugin development
- Ajax submit result opens in admin-ajax.php
- WordPress debug messages not displaying
- get author of published post
- Error passing post_content to function
- How to access all array values from do_action_ref_array()?
- Add a check box in Menu Settings
- How to register my code as a plugin
- Is there any way to fire heartbeat API from for website visitors?
- Cannot stop wpautop from messing up my plug-in output
- How can I prevent ‘500 internal server error’ because of a long install process?
- dbdelta failing with error: “WordPress database error Table ‘wp_2_myPlugin’ already exists
- Update product prices from remote file
- Displaying custom content from a plugin within the active theme
- Using wp_mail to send email?
- Which wp plugin can use Create, Edit and Delete Email address from WordPress Dashboard
- product-attribute-slug-is-too-long-28-characters-max
- Custom plugin & calling REST api of wordpress instance the plugins is running on
- Add variables from rewrite rules to query var
- Show list of categories that has posts with different taxonomies
- “add to cart” links css class “ajax_add_to_cart” doesn’t show in woocommerce in widget sidebar
- Any way, hook to add content right before the “read more” link?
- How do I specify where to save the debug.log?
- How do I ensure I can loop through every enqueued script and CSS?
- What is the source of the $post_id in a hook argument?
- WordPress Fatal error: Uncaught Error: Call to undefined function dbDelta()
- Plugins Settings page not updating
- TinyMCE 4.7.11 – Enable hidden WordPress core plugins? (referencing a wp-includes from plugin.php)
- Enqueue scripts based on site.
- My enqueue admin style function doesn’t work because of ?=ver
- Use content filter on the post that is password-protected
- WordPress filter custom posts by multi terms of of a taxonomy
- foreach argument to get specific file types getting too many returns
- How to fetch the post content from the wordpress editor before it can be saved(published)?
- How does one set cookies in WordPress without getting the ‘headers not sent’ error? within WP
- Filter the_content() to add custom figure tags
- Glyphicons Dont Show in WordPress Plugin Only
- Return all roles, including custom roles
- Change the search results header from plugin
- Mapping multiple URLs to same page
- Installing plugins on installation/activation
- Add query string variables to all hyperlinks URL matching a specified domain
- Is there such a thing as a WordPress console?
- Loading jQuery library from WordPress admin
- Programmatically creating posts based on external JSON feed (asynchronously)