ThemeFixture::setCurrentTheme()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace TddWizard\Fixtures\Theme;
5
6
use Magento\Framework\View\DesignInterface;
7
use Magento\TestFramework\Helper\Bootstrap;
0 ignored issues
show
Bug introduced by
The type Magento\TestFramework\Helper\Bootstrap was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Magento\Theme\Model\Theme\Registration;
9
10
/**
11
 * A fixture to test theme features, e.g. with with test themes in `@magentoComponentsDir`
12
 */
13
class ThemeFixture
14
{
15
16
    /**
17
     * Register new themes from the `@magentoComponentsDir` fixture in the database
18
     */
19 1
    public static function registerTestThemes(): void
20
    {
21
        /** @var Registration $registration */
22 1
        $registration = Bootstrap::getObjectManager()->get(Registration::class);
23 1
        $registration->register();
24 1
    }
25
26
    /**
27
     * Set the current theme
28
     *
29
     * @param string $themePath a theme identifier without the area, e.g. Magento/luma
30
     */
31 2
    public static function setCurrentTheme(string $themePath): void
32
    {
33
        /** @var DesignInterface $design */
34 2
        $design = Bootstrap::getObjectManager()->get(DesignInterface::class);
35 2
        $design->setDesignTheme($themePath);
36 2
    }
37
}
38