When generating mock classes, Phake will load them into memory utilizing the PHP eval() function. This can make the code inside of mock classes difficult to debug or diagnose when errors occur in this code. Using the Phake::setMockLoader() method you can change this behavior to instead dump the generated class to a file and then require that file. This will allow for accurate and easily reaserchable errors when running tests. This shouldn't typically be required for most users of Phake, however if your are having errors or working on code for Phake itself it can be incredibly useful.
Phake::setMockLoader() accepts a single parameter of type Phake_ClassGenerator_ILoader. The default behavior is contained in the Phake_ClassGenerator_EvalLoader class. If you would instead like to dump the classes to files you can instead use the Phake_ClassGenerator_FileLoader class. The constructor accepts a single parameter containing the directory you would like to dump the classes to. The classes will be stored in files with the same name as the generated class.
Below is an example of the code required to dump mock classes into the /tmp folder.
Example 6.2. Setting the Mock Class Loader
<?php require_once('Phake.php'); Phake::setLoader(Phake::CLIENT_PHPUNIT); ?>