I have my local WordPress setup I create folder named mu-plugins in wp-content/plugins/mu-plugins and in mu-plugins directory I create one file and write a simple code for test my mu-plugins not work it give no response. Any One know what shouuld ? (it work fine in live hosting setup)
I have tried to just copy the whole root folder into a subdirectory. I understand the .htaccess file has to be changed. But can't get it to work right. Is it something more than changing the htaccess file I'll have to do to make this possible? As I said in the question, I want to use the same database. So I can't change any URL's in the database. Edit: I have figured out that the site actually is going in …
I am sanitizing uploaded SVG files with wp_handle_upload_prefilter, example: // Example code add_filter( 'wp_handle_upload_prefilter', function($file) { if ( $file['type'] === 'image/svg+xml' ) { $this->sanitize( $file['tmp_name'] ); } } ); It works fine for files uploaded through the Media Library, however, if the file is uploaded programatically, it doesn't go through the filter. The reason I want to programatically upload an image is for testing purposes. I am uploading the file with wp_upload_bits function: $upload = wp_upload_bits( 'xss.svg', null, file_get_contents( $this->svg_path …
Got a mac development machine with PHP installed via brew. I'm trying to get testing tools set up. I successfully set up test scaffolding with wp cli and managed to get bin/install-wp-tests.sh to do its thing. But I get an error with phpunit tests/test-sample.php: Error: The PHPUnit Polyfills library is a requirement for running the WP test suite. If you are trying to run plugin/theme integration tests, make sure the PHPUnit Polyfills library (https://github.com/Yoast/PHPUnit-Polyfills) is available and either load the …
I'm trying to run e2e tests for my Gutenberg plugin. Here's my pertinent code import { createNewPost, enablePageDialogAccept, insertBlock, clickButton, } from "@wordpress/e2e-test-utils"; beforeAll(async () => { await enablePageDialogAccept(); }); describe("content editor basic functions", () => { test("ContentEditor shows up", async () => { await createNewPost(); return true; }); }); I get the following stacktrace Navigation failed because browser has disconnected! at /Users/nav/dev/wordpress-unified/plugins/my-plugin/node_modules/puppeteer/lib/cjs/puppeteer/common/LifecycleWatcher.js:51:147 at /Users/nav/dev/wordpress-unified/plugins/my-plugin/node_modules/puppeteer/lib/cjs/vendor/mitt/src/index.js:51:62 at Array.map (<anonymous>) at Object.emit (/Users/nav/dev/wordpress-unified/plugins/my-plugin/node_modules/puppeteer/lib/cjs/vendor/mitt/src/index.js:51:43) at CDPSession.emit (/Users/nav/dev/wordpress-unified/plugins/my-plugin/node_modules/puppeteer/lib/cjs/puppeteer/common/EventEmitter.js:72:22) at CDPSession._onClosed (/Users/nav/dev/wordpress-unified/plugins/my-plugin/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:247:14) at Connection._onMessage (/Users/nav/dev/wordpress-unified/plugins/my-plugin/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:94:25) …
I am trying to do some experiments with python and wordpress plugins. I would like to have shortcode [python] with some functionalities. I was trying this metod - Method i tried, but when I do everything by that i got error message - sh: 1: /www/doc/mywebsitename/www/wp-content/plugins/PythonEmbed/pythonScript.py: not found My PHP code: <?php # -*- coding: utf-8 -*- /** * Plugin Name: PythonWeb * Description: Python integration on web * Version: 0.0.1 * Author: mywebsitename * Author URI: mywebsitename */ add_shortcode( …
I'm working on a plugin, Index WP MySQL for Speed. For testing it would be helpful to have a very large WordPress installation containing many thousands of posts, pages, metadata entries, media items, users, options, and so forth. The meaning of the data doesn't matter -- it can be lorem ipsum text -- but having a lot of it would be great. For my purposes I don't care whether the media files in wp-content/uploads are available. I just want to …
I'm writing unit tests (not integration) for a lib I'm working on. There, we created some WP-CLI commands that I'd like to test. Most of them are just renaming things, copying and pasting things over from the lib to the project. And when something is successful or not a WP_CLI::success() or similar methods are used to output the message to the user (log, warning or error). So what I'd like to do is just to output the contents of those …
1 down vote favorite I am developing a Wordpress theme that requires testing with multiple devices over my local network. I use the localhost server XAMPP which runs apache on port 80. When I access my PC's IP (192.168.0.16) port 80 using an iPad, it returns the apache directory of which I have two sites: site1 wordpress The first site is a basic php site, this loads perfectly. The second site is Wordpress, and won't let me access it (see …
This site I inherited runs a forum on a combination of Buddyboss and Buddypress. I've had to install ReCaptcha's on all user interactions, but I'm not happy with their layout and I'm suspecting buddyboss and buddypress conflict. So, in order to find out how to fix things without breaking anything, I want a test/staging site. I tried the WP STAGING plugin, but it requires its own authentication, which bypasses the login pages I want to modify. That's not what I …
When testing a theme or plugin, you can use WP-CLI to scaffold the test suite setup, wp scaffold plugin-test plugin. So is there a good way to integrate an editor/IDE (VS Code in my case) so that autocompletion (method signatures, etc) works within the tests? Since the test library is installed in /tmp/ the editor is not indexing those files and thus thinks classes and functions are missing.
I have a bunch of custom fields in my REST API response, and I need to refactor the code for it, so I'm creating an integration test for it, just to make sure nothing breaks in the process of refactoring. The testing suite was build using wp scaffold for plugin tests. The test looks like: <?php /** * Class Api_Docs_Page * * @package My_Plugin\Routes\Endpoints */ namespace My_Plugin\Tests\Routes\Endpoints; use WP_REST_Request; use WP_UnitTestCase; /** * Class that tests the /wp-json/wp/v2/pages?slug=api-docs response. */ …
My local setup for WordPress is at http://127.0.0.3/blog. When calling https://my.domain.name/blog/wp-login.php, I get the page served; including Google CAPTCHA. But the login post to a 302 redirect to http://127.0.0.3/blog. In order to overwrite my server default domain I added locally this to my wp-config.php file: define('WP_HOME','http://127.0.0.3/blog'); define('WP_SITEURL','http://127.0.0.3/blog'); define('FORCE_SSL_LOGIN',false); define('FORCE_SSL_ADMIN',false); In my Fiddler Web Debugger script I am using the following code to redirect my browser to go to my local setup: if (oSession.HostnameIs("my.domain.name")){ oSession.bypassGateway = true; if (oSession.HTTPMethodIs("CONNECT")){ oSession["x-replywithtunnel"] = …
I´m testing my cron task. I´m not sure but it seems to be the effect of a previous code. So, I´m wondering when you modify you call function and you run now your cron task (I´m using WP Control) and you load a page, the code applied is not the most recent code you upload. It´s right or wrong ? What happens excalty, call functions are cached ?
I have just deployed the Wordpress application on my Kubernetes cluster following the instructions from https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/ Now I would like to populate the Wordpress database with a lot of posts for testing purposes. I do not really care about the content of these posts. As far as I am concerned they can be completely random. All I care that there are a lot of them. Is there a way to do it?
I've been using WordPress for awhile now but one problem I'm constantly facing is creating a local clone of a production site so I can test changes/updates. My current process goes something like this... Run XAMPP Server Download the site files (Filzilla) Download the database (phpMyAdmin) Create a local database (phpMyAdmin) Copy site files into XAMPP Import database Update WP hostname, settings, etc My question is simple. Is it possible to automate this entire process? If not, what can be …
I am testing a plugin that depends on WooCommerce. In order to properly test the integration, I need WooCommerce installed in the WordPress test application. I tried installing the plugin using wp-cli via the install_wp_tests script: wp plugin install woocommerce --activate --allow-root --path=$WP_CORE_DIR This kicks out an error: Error: 'wp-config.php' not found. From what I can tell, the test configuration file is in /tmp/wordpress-tests-lib/wp-tests-config.php. From reading the wp-cli docs, I don't see any method to specify the path to the …
I am testing my theme with Theme Check plugin and it shows this message: Required: This theme doesn't seem to display tags? Picture: How can i fix this?
Where should I check for the code coverage stats when using PHPUnit for WordPress? My WordPress setup: I have setup WordPress using VVV and my testing suite includes PHPUnit and WP-CLI. How I executed test cases to find code coverage? When I execute phpunit command to test a WordPress plugin, I'm able to see, if the test cases passed or failed. In my case there were no failures. To find the code coverage, I executed phpunit --coverage-text=./coverage.txt, the test cases …
I like to know how to test the html output of a post. Like WP would output it on the frontend in reality. My specific case at this point is to test oembed caching as I want to test re-caching. AFAIK WP does only cache oembed results if they are associated with a post. So I can not just run some text though the_content filter. I like to test the real post processioning for this and in general for other …