Completed
Push — master ( a834dc...2c3a2a )
by Fabian
15s queued 11s
created

AbstractFrontendControllerTest::setUpPreferences()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 8
rs 10
cc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace IntegerNet\GlobalCustomLayout\Test\Integration;
5
6
use IntegerNet\GlobalCustomLayout\Test\src\CategoryLayoutUpdateManager;
7
use IntegerNet\GlobalCustomLayout\Test\src\PageLayoutUpdateManager;
8
use IntegerNet\GlobalCustomLayout\Test\src\ProductLayoutUpdateManager;
9
use Magento\Framework\ObjectManagerInterface;
10
use Magento\Framework\View\LayoutInterface;
11
use Magento\TestFramework\Helper\Bootstrap;
12
use Magento\TestFramework\TestCase\AbstractController;
13
14
/**
15
 * @magentoAppIsolation enabled
16
 * @magentoAppArea frontend
17
 */
18
abstract class AbstractFrontendControllerTest extends AbstractController
19
{
20
    /** @var int */
21
    const STORE_ID = 0;
22
23
    const TEST_FILE = 'test-file';
24
25
    /** @var int */
26
    const GLOBAL_IDENTIFIER = 0;
27
28
    /**
29
     * @var ObjectManagerInterface
30
     */
31
    protected $objectManager;
32
33
    /**
34
     * @var LayoutInterface
35
     */
36
    protected $layoutInterface;
37
38
    /**
39
     * @inheritdoc
40
     */
41
    protected function setUp(): void
42
    {
43
        $this->objectManager = Bootstrap::getObjectManager();
44
        $this->layoutInterface = $this->objectManager->get(LayoutInterface::class);
45
46
        $this->setUpPreferences();
47
48
        parent::setUp();
49
    }
50
51
    private function setUpPreferences(): void
52
    {
53
        $this->objectManager->configure(
54
            [
55
                'preferences' => [
56
                    \Magento\Catalog\Model\Category\Attribute\LayoutUpdateManager::class => CategoryLayoutUpdateManager::class,
57
                    \Magento\Catalog\Model\Product\Attribute\LayoutUpdateManager::class  => ProductLayoutUpdateManager::class,
58
                    \Magento\Cms\Model\Page\CustomLayoutManagerInterface::class          => PageLayoutUpdateManager::class,
59
                ],
60
            ]
61
        );
62
    }
63
}
64