jeudi 29 octobre 2015

WordPress Unit Testing with is_plugin_active()

The plugin I'm unit testing with phpunit has a dependency on another plugin, using is_plugin_active().

When testing the dependency in my unit test that function always returns false/inactive, when the it is definitely active, because it's working properly in the plugin itself. It seems to be accessible, so there must be some logic error when it comes to this wordpress core function.

This is my code:

function test_requirementsMet_true() {
$this->assertTrue(is_plugin_active('pluginFolder/plugin.php'));
}

Does anyone know of a work-around?

Aucun commentaire:

Enregistrer un commentaire