diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index 30cca07b7a2..9bbd83a9ec6 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -473,6 +473,27 @@ namespaces in the ``phpunit.xml`` file, as done for example in the + +Under the hood, a PHPUnit listener injects the mocked functions in the tested +classes' namespace. In order to work as expected, the listener has to run before +the tested class ever runs. By default, the mocked functions are created when the +annotation are found and the corresponding tests are run. Depending on how your +tests are constructed, this might be too late. In this case, you will need to declare +the namespaces of the tested classes in your phpunit.xml.dist + +.. code-block:: xml + + + + + + + + Acme\MyClassTest + + + + Modified PHPUnit script -----------------------