ThemeFixture   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 23
ccs 7
cts 7
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setCurrentTheme() 0 5 1
A registerTestThemes() 0 5 1
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