Completed
Push — master ( d80aef...0536a3 )
by Willem
13s queued 12s
created

AbstractFrontendControllerTest::setUpPreferences()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 10
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\Util\CategoryLayoutUpdateManager;
7
use Magento\Catalog\Model\Category\Attribute\LayoutUpdateManager;
8
use Magento\Framework\ObjectManagerInterface;
9
use Magento\Framework\View\LayoutInterface;
10
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...
11
use Magento\TestFramework\TestCase\AbstractController;
0 ignored issues
show
Bug introduced by
The type Magento\TestFramework\TestCase\AbstractController 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...
12
13
/**
14
 * @magentoAppIsolation enabled
15
 * @magentoAppArea frontend
16
 */
17
abstract class AbstractFrontendControllerTest extends AbstractController
18
{
19
    /**
20
     * @var ObjectManagerInterface
21
     */
22
    protected $objectManager;
23
24
    /**
25
     * @var LayoutInterface
26
     */
27
    protected   $layoutInterface;
28
29
    /**
30
     * @inheritdoc
31
     */
32
    protected function setUp()
33
    {
34
        $this->objectManager = Bootstrap::getObjectManager();
35
        $this->layoutInterface = $this->objectManager->get(LayoutInterface::class);
36
37
        $this->setUpPreferences();
38
39
        parent::setUp();
40
    }
41
42
    private function setUpPreferences(): void
43
    {
44
        $this->objectManager->configure(
45
            [
46
                'preferences' => [
47
                    LayoutUpdateManager::class => CategoryLayoutUpdateManager::class,
48
                ]
49
            ]
50
        );
51
        $this->objectManager->removeSharedInstance(LayoutUpdateManager::class);
0 ignored issues
show
Bug introduced by
The method removeSharedInstance() does not exist on Magento\Framework\ObjectManagerInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

51
        $this->objectManager->/** @scrutinizer ignore-call */ 
52
                              removeSharedInstance(LayoutUpdateManager::class);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
52
    }
53
}
54