Make sure you have the right XDebug version for your version of PHP and add this at the very beginning of your php.ini file:
Then do an
apachectl graceful and a
phpinfo and make sure XDebug is present and active. If it is, everything should work fine. I know it does for me.
edit: I answered before reading the entire question.
before running the script you should set the environment variable;
It might be possible to do this from php but i cannot test this:
You should make sure that the php binary you are using has the XDebug extension loaded, on my system the apache module has it, but the default CLI interpreter does not, but I run different versions on purpose.
There's some good documentation here
Since the resource loader looks for files in directories and you want to test the loader's correct interaction with these directories, you should mock the filesystem. If you test with a real directory, you are risking outside change to these directories that may affect the test outcome. Using the vfs is also much faster.
I had to make an absolute path using $_SERVER['DOCUMENT_ROOT'] that way no matter what file structure I am on it works. a Truly relative path. lol.