Here are the steps/complete set of screenshots of a configuration that now works for me:
1) from command line ensure you can run buildkit -> civibuild
$ civibuild create dmaster --url http://d47.localhost --admin-pass mypass
2) from command line ensure you can run tests - that all is working properly
karins-macbook-pro:civicrm sysadmin$ pwd
[This all assumes you have civicrm-buildkit already working and that you can run CiviCRM phpunit tests successfully from the command line.]
1. Tell Netbeans which phpunit executable you're using.
Go to Tools » Options, then PHP tab, PHPUnit subtab.
Set the path of your PHPUnit script. See screenshot:
2. Create a shell script with your environment ...
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 ...
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 ...
So I figured this out. The specific hook engine for unit testing, very conveniently, comes with an injectable mock property.
After grabbing the hook engine with $this->hookClass = \CRM_Utils_Hook::singleton() you just need to inject a mock object that has a magic __call() method with somthing like:
The hook ...
This sounds like a mismatch in the phpunit versions:
Currently, most of the Civi testing runs against the PHAR build of phpunit v4.
phpunit v6 renames every class to use \ instead of _, which means that all the base-classes disappear if you run on a newer build of phpunit.
I run tests the following way
I test in a CiviCRM instance that is generated with buildkit (the toolchain provided for CiviCRM developers see https://docs.civicrm.org/dev/en/latest/tools/buildkit/ .
My tests are generated with civix generate:test. Remarks that this generator also creates the file tests/phpunit/bootstrap.php that takes care of the class ...