PHPUnit - Error?

I'm new to PHPUnit. Can someone tell me what this means?

Class 'PHPUnit_Framework_MockObject_Matcher_InvokedRecorder' not found


I'm running with the PHPStorm GUI, I was just testing to try to find out why it wouldn't work.


OK, let's assume you have your project in "C:\Projects\MySite" & you keep your test files in "tests" subfolder. If you need just 1 config/1 bootstrap file, you just should name them phpunit.xml & bootstrap.php and put in "C:\Projects\MySite\tests\" folder and PHPUnit should pick them up automatically (it is true at least for phpunit.xml).

In your phpunit.xml file you can reference your bootstrap file as simple as this (without mentioning full path):

<?xml version="1.0"?>

I see. I would recommend to run the tests from command line using phpunit command for the time being (since you are having all these problems) -- in case PhpStorm has errors in their implementation.


I don't think that that method is going to work. None of my tests are in /phpunit. They are all in /phpunit/library/classes and /phpunit/library/classes/apps (too many test files and I want the test folder structure to mimic the real one.)


I was able to get my bootstrap to work across these different folders like this:

$_SERVER["DOCUMENT_ROOT"]     = str_replace("\\phpunit", "", __DIR__)."\\";


I think it is a matter of organizing the stuff properly. For example, have a look at Phing's test suite (how they did it, their directory structure) -- they have only 1 config file and 1 bootstrap file, but their test files are somewhere in 3-level deep folders.


So, the only thing that each team member has to do now is set the phpunit.xml file (tried to get it to pick up automatic

ally, but no go), in the runConfiguration. All the files are now transportable!

So, the only thing that each team member has to do now is set the phpunit.xml file (tried to get it to pick up automatically, but no go), in the runConfiguration

It will pick it up automatically for sure (confirmed in manual) if using phpunit command (command must be invoked from the same folder where config file is located). If you run it via PhpStorm, then it may not work indeed (that is a custom test runner which most likely has nothing to do with phpunit command -- I have not checked how exactly it works)

All the files are now transportable!

So, is it all working fine now?  Congratulations!!!


yes, and thanks for all your help.


Please sign in to leave a comment.