getOriginalFunctionMock(self::getClassNamespace($namespace), $name); } public static function defineFunctionMock($namespace, $name): void { self::defineOriginalFunctionMock(self::getClassNamespace($namespace), $name); } /** * Override this method since original implementation relies on the PHPUnit's state, * but we're dealing with the Codeception, which uses different event system */ public function registerForTearDown(Deactivatable $deactivatable): void { $this->deactivatables[] = $deactivatable; } protected function _after(): void { parent::_after(); foreach ($this->deactivatables as $deactivatable) { $deactivatable->disable(); } $this->deactivatables = []; } private static function getClassNamespace(string $className): string { return (new ReflectionClass($className))->getNamespaceName(); } }