lundi 26 octobre 2015

Mocking in Wordpress unit test

The function I'm testing requires another plugin, but I want to test it in isolation without having that plugin activated.

function functionName() {
   ...
   if (!is_plugin_active('path/to/plugin.php')) {
      return false;
   }
   return true;
}

How can I simulate that call returning true when I write a unit test?

Aucun commentaire:

Enregistrer un commentaire