1. Home
  2. Documentation
  3. WordPress SDK
  4. Testing

Testing

Before you release a version of your product that has Freemius integrated in it, to production, you probably want to test things out, making sure everything works properly.

Here’s what Freemius recommends in terms of testing the functionality & integration:

Setting Freemius Into Development Mode

Add the following constants to your testing environment’s wp-config.php file while replacing my-slug in WP_FS__my-slug_SECRET_KEY with your plugin’s or theme’s unique lowercase slug:

/* Set Freemius into development mode */
define( 'WP_FS__DEV_MODE', true );
/* 
 * Set your plugin / theme Freemius secret key for super powers!
 *   1. Replace `my-slug` with your product's lowercase slug.
 *   2. Replace `sk_mySecretKey` with your product's secret key.
 */
define( 'WP_FS__my-slug_SECRET_KEY', 'sk_mySecretKey' );

You should add the defines before the WordPress Engine starts, i.e. before /* That is all, stop editing! Happy blogging. */.

When you refresh the WP Admin, you should notice a new top level menu item and if you click it, you’ll be able to see all the Freemius data associated with your local environment.

Freemius SDK - Development mode WP Admin menu item

The WP_FS__DEV_MODE will enable logging. You can see the logs by inspecting the browser’s developers console:
Freemius SDK - Development mode showing developers browser console logging

Or if you are using Debug Bar, Freemius is fully integrated with it:
Freemius SDK - Development mode integration with WP debug bar

Testing User Opt-in

For apparent reasons – the opt-in screen appears only once (upon activation). After opting-in (or skipping) the screen will not show again.

To make it appear again after an opt-in you’ll need to delete the installation from Freemius. You can do that by clicking the Account submenu item:
Freemius SDK - Account Details submenu item

To make it appear after skipping, clear Freemius data by opening Freemius Debug in the admin dashboard, and delete the accounts (for more info on Freemius debug please see our debugging guide).

Freemius SDK debug screen

Skipping Email Activation

Due to security and data integrity reasons, if an already opted-in user attempts to opt-in to Freemius again, you will first receive an activation email so you may complete the process. This helps prevent users from hijacking other user accounts.

This step might slow down the development & testing process. To skip it, simply add the following constant to your testing environment’s wp-config.php file in addition to the previously added constants:

/* Skip email activation when a user with the same email already opted-in */
define( 'WP_FS__SKIP_EMAIL_ACTIVATION', true );

Sandbox Payments

Freemius provides an option for you to sandbox test payment for your products, in order for you to be able to experience your product’s checkout process, as well as make sure that everything works as it should. Here’s how to use it:

To set Freemius into sandbox payments mode, make sure your wp-config.php file contains the following constant with your secret key:

/* 
 * Set your plugin / theme Freemius secret key for super powers!
 *   1. Replace `my-slug` with your product's lowercase slug.
 *   2. Replace `sk_mySecretKey` with your product's secret key.
 */
define( 'WP_FS__my-slug_SECRET_KEY', 'sk_mySecretKey' ); 

Testing credit cards

Card Number Card Type
4242424242424242 Visa
4000056655665556 Visa (debit)
5555555555554444 MasterCard
5200828282828210 MasterCard (debit)
5105105105105100 MasterCard (prepaid)
378282246310005 American Express
6011111111111117 Discover
30569309025904 Diners Club
3530111333300000 JCB

Testing PayPal accounts

Type Email Password Country Verified Credit Card
Personal [email protected] freemius US true Visa
Business [email protected] freemius US true Visa

You can login with the above credentials into a PayPal Sandbox to see the account activity.