When running the PHPUnit tests, WordPress will load the config from wp-tests-config.php
instead of wp-config.php
. You need to add your database connection details in wp-tests-config.php
.
And if you use MAMP or AMPPS to host your database, you will have to use 127.0.0.1 as DB_HOST instead of localhost. Alternatively use the PHP version supplied by the Solution stack of choice, or set DB_HOST to ‘:/path/to/soulution/stack/mysql.socket’.
Related Posts:
- Install and load additional plugins when running unit tests
- 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
- Unable to write test cases for a WordPress plugin using PHPUnit and WP-CLI
- Unit Testing a Plugin functionality with cron
- PHPUnit test plugin activation
- How Can I setup WP CLI on Windows development machine running AMPPS?
- Why is WP_Mock not used instead of WP_UnitTestCase for writing unit tests by most plugins?
- how to set context in WordPress for unit testing
- Unit testing a plugin with a theme dependency
- Update custom plugin with WP-CLI
- adding wp-cli commands to plugin: how to document to users?
- Is it possible to use WP-CLI in a plugin (or theme)?
- PHPUnit Testing and woocommerce Constant
- Unit Testing action hook
- PHPUnit Ajax Serialization of ‘Closure’ is not allowed
- PHPUnit Testing Installation Issue
- Woocommerce Single Product Tabs Got Duplicate
- Replace the WordPress Media Library Uploader
- How to prevent users from deleting their accounts?
- Performing ajax request in wordpress
- How do I get a reference to the HTML memory buffer while the page is being constructed?
- do_action from within a class does not seem to work
- How to create save function for custom Gutenberg style block?
- Warning: Illegal string offset ‘Andorra’ in … on line 106
- Woocommerce product not appearing in category list page when created programatically [closed]
- Inserted data from database does not showing on front-page without referesh page?
- Error when activating a custom plugin on production server
- Remove tag from all posts when publishing new post
- add_meta_box does not display meta box in Admin
- How to call a plugin function from a page
- Allow user to add the php code in wp_mail()
- Custom Plugin activation error in Multisite
- The Events Calendar featured image as body background?
- woocommerce wc_get_product is not fetching all the product of particular category
- Integrating colorpicker into array field
- WordPress plugin how to run function when button is clicked
- wp_ajax function return the html page
- Buddy Press restrict the capability to edit users
- Override WooCommerce files from plugin
- using wordpress acf shortcods in tables goes outside the table
- Add WordPress Meta Box saved form input to WordPress RSS feed [duplicate]
- $_SESSION inside php function executed by AJAX
- Two same AJAX calls – one is working, other doesn’t
- ajax multiple Values
- Change Label of custom post type
- BuddyPress and namespacing
- Hiding class namespace from plugin’s extensions
- OOP development and hooks
- woocommerce add a new bulk action in the bulk actions dropdown in the orders list
- How to trigger WooCommerce user profile edit change?
- Creating a virtual page without exit
- How to include files in the loop via ajax
- Return raw image proxy for wordpress plugin
- Yoast and another plugin
- How to set a public variable in someone else’s plugin class
- Plugin Development – Call to undefined function comment_exists()
- How to handle ajax Request in a complex-structured plugin?
- Replace “content-area” of themes 404 page with plugin?
- Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?
- Override theme’s WooCommerce file
- TinyMCE 4.7.11 – Enable hidden WordPress core plugins? (referencing a wp-includes from plugin.php)
- Use admin-post to submit form data to external database
- How to create plugin settings page for each admin user?
- Plugin removes itself if mistake made during edit
- Using meta_key & meta_value in add_rewrite_rule
- Using JavaScript in WordPress page to call for server data using AJAX
- implementing socket.io with wordpress
- Code for cron to delete posts that contain specific expression (e.g. “unable to fetch” every 30 minutes
- wp_editor embed shortcode not working within my plugin
- If user is logged-in display/hide widgets ( siteorigine) [closed]
- Javascript not being loaded only in custom taxonomy template
- User avatar-ACF fields
- wp_ajax add_action fuction won’t fire on custom jQuery action
- How can I specify the plugin language in WordPress?
- WC_Geolocation not found inside plugin
- Set widget icon in Customizer?
- Add new header/footer on landing page with plugin
- bindParam? WordPress 4.9.5 SQL LIKE statement %s and %LIKE%
- tweaking the
- Redirect theme directory to plugin theme directory
- Hiding WordPress REST endpoints from public viewing using Basic Authentication
- Save in my custom admin page and redirect to the saved object
- Plugin setting page – update_option problem
- Plugin with functions inside a class & how to trigger WP CRON
- Pass javascript result to shortcode executer function
- Filterable posts using categories
- How to get values from Tinymce visual editor popup?
- “Headers Already Sent” Nightmare on Plugin
- remove different admin menu for specific users
- add pagination to wp_remote_get
- Where to store Plugin specific information in the database
- One-way DB Migration Workflow
- Adding and handling custom settings tab to fusion element