I\'ve written a package and as part of the development proccess I want to run unit tests on it. This basically means I need a bootstrap file to register the autoloader for m
Yes you should run composer update. It is not harmful to try since everything is put into /vendor/ which you can later delete.
Well, I've figured the answer.
Composer provides it's own autoloader I could use.
composer install or composer update in the project root. This will create the vendor dir with composers autoload.php file.vendor dir to .gitignore along with composer.lockphpunit.xml.dist specify composer's autoloader as the bootstrap fileExample phpunit.xml.dist file
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="Your package's test suit">
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
Notice the bootstrap entry there.