Codeception\Module\WPDb::useTheme PHP Method

useTheme() public method

Sets the current theme options.
public useTheme ( string $stylesheet, string | null $template = null, string | null $themeName = null )
$stylesheet string The theme stylesheet slug, e.g. `twentysixteen`.
$template string | null The theme template slug, e.g. `twentysixteen`, defaults to `$stylesheet`.
$themeName string | null The theme name, e.g. `Twentysixteen`, defaults to title version of `$stylesheet`.
    public function useTheme($stylesheet, $template = null, $themeName = null)
    {
        if (!is_string($stylesheet)) {
            throw new \InvalidArgumentException('Stylesheet must be a string');
        }
        if (!(is_string($template) || is_null($template))) {
            throw new \InvalidArgumentException('Template must either be a string or be null.');
        }
        if (!(is_string($themeName) || is_null($themeName))) {
            throw new \InvalidArgumentException('Current Theme must either be a string or be null.');
        }
        $template = $template ?: $stylesheet;
        $themeName = $themeName ?: ucwords($stylesheet, " _");
        $this->haveOptionInDatabase('stylesheet', $stylesheet);
        $this->haveOptionInDatabase('template', $template);
        $this->haveOptionInDatabase('current_theme', $themeName);
        $this->stylesheet = $stylesheet;
        $this->menus[$stylesheet] = empty($this->menus[$stylesheet]) ? [] : $this->menus[$stylesheet];
    }
WPDb