简体   繁体   中英

How can I tell phpunit where the source and tests can be found

I am a newbie with phpunit but I need it to test something

So, suppose that have the following folders

mainFolder/SRC/x/y/sourceFiles.php
mainFolder/TESTS/x/y/testFiles.php
mainFolder/TESTS/bootstrap.php

When I run phpunit mainFolder it tells me:

Fatal error: Class 'x/y/sourceFile' not found in mainfolder/tests/x/y/testfile.php on line 28

Note that I am a newbie, and I need some help. Thanks

The test files should be able to find the tested classes. Which means you have to require them, or set up a proper autoloading mechanism or pre-load them in a bootstrap file. And probably there are lots of other ways to do this. The test files behave exactly the same in this sense like simple php files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM