Reputation: 187
I have a parent and a child classes - loaded with spl_register_autoload()) and I'm trying to write PHPUnit tests; I have a problem with the inheritance : when I run tests, this warning message appears:
Warning: include(classes/PHPUnit\Composer\Autoload\ClassLoader.class.php): failed to open stream: No such file or directory in C:\wamp64\www\test\test\unit_tests\test\Employe9Test.php on line 36.
Any idea?
Upvotes: 0
Views: 213
Reputation: 1730
The relative path to ClassLoader.class.php is not found when the file is called from Employe9Test.php
If you need an autoloader for your tests, may I suggest you to use the bootstrap property in the phpunit config file?
<phpunit bootstrap="src/autoload.php">
<testsuites>
<testsuite name="money">
<file>tests/IntlFormatterTest.php</file>
<file>tests/MoneyTest.php</file>
<file>tests/CurrencyTest.php</file>
</testsuite>
</testsuites>
</phpunit>
That way you won't have to adjust/edit the autoload file path in each of your test file if the autoload file path changes.
Upvotes: 1