5

The conventional approach Generally, the safe play is to make a file like <myextension>/CRM/MyExtension/MyClass.php: <?php class CRM_MyExtension_MyClass { ...} (Be sure to match the capitalization of files and classes.) Most documentation and tooling is based on CRM_* conventions, and a handful of things in core (such as ...


4

This is an issue with intermediate base-classes for tests (like VolunteerTestAbstract). The most reliable solution I've found is to put a require_once to load the intermediate base-class. For example, this is what I used in uk.co.vedaconsulting.mosaico: require_once __DIR__ . '/TestCase.php'; class CRM_Mosaico_MosaicoTemplateTest extends ...


2

Ok, so it turns out I was kinda doing something wrong... What I needed was a simple \ prefix: \Civi::log()->info('Hello, log!');


2

Civi's autoloader does not load classes outside the CRM directory. In order for that to work, you'll have a few options: Implement your own autoloader capable of loading classes inside the test/phpunit dir Use require to include the class Put the VolunteerTestAbstract class inside your CRM dir I usually use the second option for that and include/require ...


Only top voted, non community-wiki answers of a minimum length are eligible