I'm still new to Unit testing, and specifically PHPUnit as the testing framework.
Suppose I'm building a unit test for a resource loader class. The class looks for resources to load in two directories (a global and a user-specific one).
To test the class, I would like to set up a mock testing directory containing some resource files. I would like to put the mock directory somewhere within the test suite (the suite is part of a web application that will get distributed.)
Is there a convention for where to put this testing directory in the context of a PHPUnit test suite composed using the file system as outlined here?
Is there a way (e.g. a constant defined by PHPUnit when it runs the test) to access such a mock directory from within a unit test without having to specify its exact location, i.e. a path relative to the current test suite? Or do I just use dirname(__FILE__)
and compose an absolute path from that?