Skip to content

Commit 29e1368

Browse files
authored
Merge pull request #5803 from magento-trigger/trigger-pr-1
[trigger] 2.4 bug fixes
2 parents 5fca50e + e755387 commit 29e1368

File tree

5 files changed

+21
-14
lines changed

5 files changed

+21
-14
lines changed

app/code/Magento/Developer/Model/Logger/Handler/Debug.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ class Debug extends \Magento\Framework\Logger\Handler\Debug
2121
*/
2222
private $state;
2323

24-
/**
25-
* @var ScopeConfigInterface
26-
*/
27-
private $scopeConfig;
28-
2924
/**
3025
* @var DeploymentConfig
3126
*/
@@ -34,22 +29,19 @@ class Debug extends \Magento\Framework\Logger\Handler\Debug
3429
/**
3530
* @param DriverInterface $filesystem
3631
* @param State $state
37-
* @param ScopeConfigInterface $scopeConfig
3832
* @param DeploymentConfig $deploymentConfig
3933
* @param string $filePath
4034
* @throws \Exception
4135
*/
4236
public function __construct(
4337
DriverInterface $filesystem,
4438
State $state,
45-
ScopeConfigInterface $scopeConfig,
4639
DeploymentConfig $deploymentConfig,
4740
$filePath = null
4841
) {
4942
parent::__construct($filesystem, $filePath);
5043

5144
$this->state = $state;
52-
$this->scopeConfig = $scopeConfig;
5345
$this->deploymentConfig = $deploymentConfig;
5446
}
5547

app/code/Magento/Developer/Model/Logger/Handler/Syslog.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,10 @@ class Syslog extends \Magento\Framework\Logger\Handler\Syslog
2929
private $deploymentConfig;
3030

3131
/**
32-
* @param ScopeConfigInterface $scopeConfig Scope config
3332
* @param DeploymentConfig $deploymentConfig Deployment config
3433
* @param string $ident The string ident to be added to each message
35-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3634
*/
3735
public function __construct(
38-
ScopeConfigInterface $scopeConfig,
3936
DeploymentConfig $deploymentConfig,
4037
string $ident
4138
) {

app/code/Magento/Developer/Test/Unit/Model/Logger/Handler/SyslogTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ protected function setUp(): void
4444
$this->deploymentConfigMock = $this->createMock(DeploymentConfig::class);
4545

4646
$this->model = new Syslog(
47-
$this->scopeConfigMock,
4847
$this->deploymentConfigMock,
4948
'Magento'
5049
);

lib/internal/Magento/Framework/Interception/ObjectManager/Config/Developer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public function setInterceptionConfig(\Magento\Framework\Interception\ConfigInte
5858
public function getInstanceType($instanceName)
5959
{
6060
$type = parent::getInstanceType($instanceName);
61-
if ($this->interceptionConfig && $this->interceptionConfig->hasPlugins($instanceName)
62-
&& $this->interceptableValidator->validate($instanceName)
61+
if ($this->interceptionConfig && $this->interceptionConfig->hasPlugins($type)
62+
&& $this->interceptableValidator->validate($type)
6363
) {
6464
return $type . '\\Interceptor';
6565
}

lib/internal/Magento/Framework/Interception/Test/Unit/ObjectManager/Config/DeveloperTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,23 @@ public function testGetOriginalInstanceTypeReturnsInterceptedClass()
5858
$this->assertEquals('SomeClass\Interceptor', $this->model->getInstanceType('SomeClass'));
5959
$this->assertEquals('SomeClass', $this->model->getOriginalInstanceType('SomeClass'));
6060
}
61+
62+
/**
63+
* Test correct instance type is returned when plugins are created for virtual type parents
64+
*
65+
* @return void
66+
*/
67+
public function testGetInstanceTypeWithPluginOnVirtualTypeParent() : void
68+
{
69+
$reflectionClass = new \ReflectionClass(get_class($this->model));
70+
$reflectionProperty = $reflectionClass->getProperty('_virtualTypes');
71+
$reflectionProperty->setAccessible(true);
72+
$reflectionProperty->setValue($this->model, ['SomeVirtualClass' => 'SomeClass']);
73+
74+
$this->interceptionConfig->expects($this->once())->method('hasPlugins')->with('SomeClass')->willReturn(true);
75+
$this->model->setInterceptionConfig($this->interceptionConfig);
76+
77+
$instanceType = $this->model->getInstanceType('SomeVirtualClass');
78+
$this->assertEquals('SomeClass\Interceptor', $instanceType);
79+
}
6180
}

0 commit comments

Comments
 (0)