I'm working on the Liquid Messages plugin. There are some basic PHPUnit tests existing for it and when I run phpunit all pass except for one. It errors out:
There was 1 error:
1) GCS_Async_Test::test_class_access
Exception: Invalid GC_Sermons_Plugin property: async
/long/path/wp-content/plugins/lqd-messages/gc-sermons.php:330
/long/path/wp-content/plugins/lqd-messages/tests/test-async.php:10
The weird thing is that gc-sermons.php contains a number of properties similar to this one. They are initialized like so:
protected $sermons
protected $taxonomies
protected $async
Instances of the classes are attached to the properties:
public function plugin_classes()
{
require_once self::$path . 'functions.php';
// Attach other plugin classes to the base plugin class.
$this->sermons = new GCS_Sermons($this);
$this->taxonomies = new GCS_Taxonomies($this->sermons);
$this->async = new GCS_Async($this);
$this->shortcodes = new GCS_Shortcodes($this);
}
If we look at GCS_Sermons, which is similar to GCS_Async in that it extends another class we see:
class GCS_Sermons extends GCS_Post_Types_Base {
Essentially the same as GCS_Async:
class GCS_Async extends WP_Async_Task {
If we look at the tests we see that the same test is run against GCS_Sermons as GCS_Async, but only fails with GCS_Async:
function test_class_access() {
$this->assertTrue( gc_sermons()->sermons instanceof GCS_Sermons );
}
function test_class_access() {
$this->assertTrue( gc_sermons()->async instanceof GCS_Async );
}
Any ideas why?