Test sites are separate versions of your published sites that let you develop and test code changes before publishing them. This allows you to experiment with new code and features without risk to the published site.
When you use a test site on a site with code, the published and test versions of your site work differently with certain features.
This article covers how test sites work with the following features:
Both your published site and test site share the same database collections. When you update, insert, or delete data from either version, the changes affect both sites immediately.
However, your database schema can differ between versions. A field that exists in your test site schema might not exist in your published site schema. Since collection data persists regardless of schema changes, this won't break your site functionality.
To use backend event handlers on your test site, you must first publish your production site at least once. If you define a backend event handler without ever publishing the production site, the handler won't run.
After publishing at least once, backend event handlers can behave differently on your published and test sites.
For example, suppose you have an onNewOrder handler. On your published site, this handler might send confirmation emails to a@supplier.com. On your test site, you could update the handler to send confirmation emails to b@supplier.com instead. Whenever a site visitor places an order on your published site, an email is sent to a@supplier.com. But when a site visitor places an order on your test site, an email is sent to b@supplier.com.
Only scheduled jobs from your published site run. Jobs scheduled in your test site never run.
To use service plugins on your test site, you must first publish your production site once after implementing the plugin.
After publishing at least once, service plugins can behave differently on your published and test sites. This allows you to test changes to your service plugin on the test site before publishing them to your production site.
Currently the Realtime API is partially supported for test sites. Keep the following considerations in mind:
The PermissionsRouter and realtime_check_permissions aren't supported on test sites.
When you publish a message to a channel that both your published and test sites subscribe to, both sites receive the message, regardless of which site published it. However, if you publish a message to a channel that only your test site subscribes to, only the test site receives that message.