Skip to content

Commit 3df55f9

Browse files
committed
MAGETWO-33080: Preferences, Shared Instance creation and Compiled Factory optimization
- fixed test
1 parent 94817b3 commit 3df55f9

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Factory/CompiledTest.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public function testCreateSimple()
5151
{
5252
$expectedConfig = $this->getSimpleConfig();
5353

54-
$requestedType = 'Magento\Framework\ObjectManager\Factory\Fixture\Compiled\SimpleClassTesting';
54+
$requestedType = 'requestedType';
55+
$type = 'Magento\Framework\ObjectManager\Factory\Fixture\Compiled\SimpleClassTesting';
5556
$sharedType = 'Magento\Framework\ObjectManager\Factory\Fixture\Compiled\DependencySharedTesting';
5657
$nonSharedType = 'Magento\Framework\ObjectManager\Factory\Fixture\Compiled\DependencyTesting';
5758

@@ -64,6 +65,15 @@ public function testCreateSimple()
6465
[$nonSharedType, null]
6566
]
6667
);
68+
$this->config->expects($this->any())
69+
->method('getInstanceType')
70+
->willReturnMap(
71+
[
72+
[$requestedType, $type],
73+
[$sharedType, $sharedType],
74+
[$nonSharedType, $nonSharedType]
75+
]
76+
);
6777

6878
$this->factory->setArguments(
6979
[
@@ -90,7 +100,8 @@ public function testCreateSimpleConfiguredArguments()
90100
{
91101
$expectedConfig = $this->getSimpleNestedConfig();
92102

93-
$requestedType = 'Magento\Framework\ObjectManager\Factory\Fixture\Compiled\SimpleClassTesting';
103+
$type = 'Magento\Framework\ObjectManager\Factory\Fixture\Compiled\SimpleClassTesting';
104+
$requestedType = 'requestedType';
94105
$sharedType = 'Magento\Framework\ObjectManager\Factory\Fixture\Compiled\DependencySharedTesting';
95106
$nonSharedType = 'Magento\Framework\ObjectManager\Factory\Fixture\Compiled\DependencyTesting';
96107

@@ -103,6 +114,15 @@ public function testCreateSimpleConfiguredArguments()
103114
[$nonSharedType, null]
104115
]
105116
);
117+
$this->config->expects($this->any())
118+
->method('getInstanceType')
119+
->willReturnMap(
120+
[
121+
[$requestedType, $type],
122+
[$sharedType, $sharedType],
123+
[$nonSharedType, $nonSharedType]
124+
]
125+
);
106126

107127
$this->factory->setArguments(
108128
[

dev/tests/unit/testsuite/Magento/Tools/Di/App/CompilerTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,17 @@ private function getPreferences()
106106
'Magento\Tools\Di\Compiler\Config\Writer\Filesystem',
107107
'Magento\Tools\Di\Compiler\Log\Writer\WriterInterface' =>
108108
'Magento\Tools\Di\Compiler\Log\Writer\Console'
109+
],
110+
'Magento\Tools\Di\Compiler\Config\Chain\ModificationChain' => [
111+
'arguments' => [
112+
'modificationsList' => [
113+
'PreferencesResolving' =>
114+
['instance' => 'Magento\Tools\Di\Compiler\Config\Chain\PreferencesResolving'],
115+
'ArgumentsSerialization' =>
116+
['instance' => 'Magento\Tools\Di\Compiler\Config\Chain\ArgumentsSerialization'],
117+
]
109118
]
119+
]
110120
];
111121
}
112122

0 commit comments

Comments
 (0)