IT Nursery
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...
  • May 26, 2022
  • 0 Comments
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 =...
  • May 24, 2022
  • 0 Comments
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...
  • May 22, 2022
  • 0 Comments
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...
  • May 20, 2022
  • 0 Comments