Having just tried out the Theme Unit Test Data from the WordPress.org Codex, I noticed that some of the body text doesn’t import properly on my set up which...
I am currently doing TDD with WordPress, in the PHPUnit I need to test if the meta box is actually registered on a method call, I could not find...
Sorry I feel like really stuck here. I have a plugin introducing a new Rest API controller (WP_REST_Controller) with basically a single endpoint which uses a separate class as...
I’m writing up unit tests for my plugin and I need a logged in user to test, but I can’t find the admin password anywhere. Does anybody know what...
I have created a wordpress plugin which converts shortcodes to content based on the entry saved on the dataase: global $wpdb; $post_id = get_the_ID(); $post_content = get_the_content(); $pattern =...
I’ve been working very hard to get PHPUnit to play nice with WordPress (with the help of this, this, this, this, and this), and I think I’ve gotten pretty...
I have written a plugin, and am going through the process of setting up some unit tests for it. Inside of my unit tests I am utilizing the WP_UnitTest_Factory...
I’m trying to run PHPUnit to unittest a WordPress plugin, but the error below keeps showing up. Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /private/tmp/wordpress/wp-includes/wp-db.php on line...
For writing unit-tests, why do most plugins use WP_UnitTestCase instead of popular libraries like WP_Mock? The reason I am asking this is because WP_UnitTestCase doesn’t seem to be a...
I’m trying to mock get_adjacent_post for unit testing but I’m not sure how to mock global function in PHPUnit $badCode = $this->getMockBuilder('get_adjacent_post') ->setMethods(array('somthing')) ->getMock(); Here’s what I got so...