Codeception\Module\WPSugarMethods::loadWpComponent PHP Метод

loadWpComponent() публичный Метод

Includes a WordPress component file that's not included by default by WordPress.
public loadWpComponent ( string $component )
$component string The component human-readable name, see the supportedWpComponents() for a list.
    public function loadWpComponent($component)
    {
        if (!is_string($component)) {
            throw new \InvalidArgumentException('Component name must be a string');
        }
        $supportedComponents = $this->supportedWpComponents();
        if (!isset($supportedComponents[$component])) {
            throw new \InvalidArgumentException("Component '{$component}' is not supported.");
        }
        $componentPath = $this->config['wpRootFolder'] . DIRECTORY_SEPARATOR . $supportedComponents[$component];
        if (!file_exists($componentPath)) {
            throw new \InvalidArgumentException("Component path [{$componentPath}] does not exist.");
        }
        include_once $componentPath;
        codecept_debug("Included the [{$component}] component including file [{$componentPath}]");
    }