As the testing database is (usually, and should be) a separate database, you will need to set the appropriate option value in the setUp routine (using add_option or update_option).
I would also recommend deleting or reseting the option in the teardown method as well, but I have had issues when trying to drop tables (see Plugin development with unit tests).
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
- Install and load additional plugins when running unit tests
- Unit Testing a Plugin functionality with cron
- 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
- register_uninstall_hook() vs uninstall.php – which one is better way to handle plugin uninstallation script?
- Email verification for new users
- How to implement bulk actions in my plugin?
- Dashboard like meta boxes in my plugin – how to save their position and open/closed state?
- Using AJAX in FrontEnd with WordPress Plugin Boilerplate (wppb.io)
- How do I implement a jQuery UI dialog modal in a WP plugin?
- Authoritative answer on which boots first – Plugins or Themes?
- How to Add Font Awesome Icons to WordPress Menus?
- How can the tinyMCE dom be manipulated (offical API does not seem to work)?
- stray elements
- Deletion of shared options using uninstall.php
- Pass javascript result to shortcode executer function
- Plugin Settings not Saving on Ajax re-ordered table
- Can we create a category list page in WordPress?
- How to include class from addon after to be sure one class exists in the main plugin?
- Undefined function wp_set_password
- WordPress password reset – why post rp_key?
- How to modify the new WordPress 4.5 link inline toolbar
- Is it possible to check is loaded language files correctly with WordPress plugin?
- How to install WordPress Popular Posts plugin twice?
- Get the link text
- Multisite plugin development and wp_enqueue_script
- Prevent plugin from deleting important directories
- Default category got deleted. How to get it back as ID=1?
- Is Dreamweaver CS5 a serious choice for theme/plugin development?
- What allows a template file from plugin to be copied in child theme and overridden?
- How to set “Site Address (URL)” programmatically on WP multisite?
- creating custom archive template within plugin for custom post type using archive_template filter
- Reset plugins version cache | pre_set_site_transient_update_plugins
- Add column and post filter for a custom post type field on the edit.php page
- Trying to understand order and frequency of action hooks firing
- Create & Save multiple Meta-boxes
- How to fetch all images from a WordPress draft using PHP?
- Can’t get woocommerce_get_price_html to work [closed]
- jQuery selectors for editor elements safe to use?
- wp_set_object_terms not updating database without a die()
- parse content from wikipedia article replacing search term with the title of article
- Fatal error: Uncaught Error: Call to undefined function get_option()
- Strange Situation When Try To Retrieve Github Gist Using wp_remote_get
- jQuery does not enqueue for my purpose… (before an inline script in the footer)
- how to get all the child category name in a specified category name?
- Can I add custom css to an mu-plugin?
- Change WooCommerce Email Header using custom plugin
- How to get the current page Title and Page URL in footer.php
- insert query on a custom table using ajax with jQuery plugin Jeditable
- How to add search form in main page body?
- WordPress Rest API with rest_do_request, possible race condition?
- Need help about understand api, wp, $ syntax in WordPress plugin script
- Is it possible to use WP-CLI in a plugin (or theme)?
- Load php file with jquery in single.php
- Restore svn trunk of my plugin repository to the initial state?
- Anyone using unzip_file successfully? It uploads the zip but doesn’t extract it!
- WP 3-way voting system: On to something! Please help!
- Why is the expected file not being deleted?
- How to determine which capability to use?
- How does one update complex options?
- Hook to execute after deleting a Custom Taxonomy
- Forbidden Error in ajax call with wordpress
- How to use setAttributes outside of the edit function return
- WP plugin svn checkout 429 error “Too many requests”
- Custom non-template page on front end fails to render
- Add custom parameter for custom user role
- Post is uncatagorized in publish_post action
- WordPress Filesystem create CSS-File – get Shortcode ID for Name
- How to add admin.php to WP Admin Menu Link
- Add the Twitter Bootstrap framework for the development of my plugins
- Code to add template to page
- Single_template for a custom post type created from a plugin is returning an empty page
- How to retrieve custom profile fields associated with different users
- Convert each new line in the textfield as a new value in an array
- Navigate to external link if last page or post in a category
- How do I control the list of Pages an author can see?
- Is there a general way to get a themes primary colour?
- How to work with AJAX and WordPress?
- How to Register/Link to .js Files in WordPress Dynamicaly in Header.php
- Add Page With Parent ID
- Thumbnails for media Library images
- Best Way to Inventory the Media Library of a 200+ Multisite Installation?
- upload script in plugin development [duplicate]
- Can I log the searches that are returning 404 in the DB?
- How to enable auto update for embedded plugins
- My activator class isn’t running the code inside