function beforeTestMethod($methodName) { $out = parent::beforeTestMethod($methodName); $testedClassName = self::getTestedClassNameFromTestClass($this->getClass(), $this->getTestNamespace()); $testedNamespace = substr($testedClassName, 0, strrpos($testedClassName, '\\')); $this->getPhpMocker()->setDefaultNamespace($testedNamespace); return $out; }