PHPunit - CLI PHP file includes/requires -


For example if I have a php script named 'runAllTests.php' '/ var / www / tests / RunAllTests .php '' and I execute phpunit within that directory, which contains "RunAllTests.php".

If I execute phpunit on the same file, then the files contained in '/ var / www /', "RunAllTests.php" can not be located from the second directory. - "Failed to open the stream:" There is no such file or directory "

I have kept it a little ambiguous, let me know that you need some more features.

< P>

Your requirements are incorrect / not portable: They expect the directory of the file (or some other fixed directory).

< / P>

Your options are as follows:

  1. Just start the process from the right directory.
  2. chdir (__DIR__) in your script.
  3. Your file consistently / related to the __DIR __ (which is the IMHO most portable) <

  • Comments