Skip to content

Commit 5ef07ff

Browse files
author
Bogdan Padalko
committed
Merge remote-tracking branch 'origin/MAGETWO-33080' into develop
2 parents 7a66a31 + 9313259 commit 5ef07ff

File tree

33 files changed

+1094
-184
lines changed

33 files changed

+1094
-184
lines changed

dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,32 @@ function ($className) {
5656
)
5757
);
5858

59+
$sharedInstances = [
60+
'Magento\Framework\App\Cache\Type\Config' => $cache,
61+
'Magento\Framework\App\ObjectManager\ConfigLoader' => $configLoader,
62+
'Magento\Framework\App\ObjectManager\ConfigCache' => $configCache,
63+
'Magento\Framework\Config\ReaderInterface' => $this->getMock(
64+
'Magento\Framework\Config\ReaderInterface'
65+
),
66+
'Magento\Framework\Config\ScopeInterface' => $this->getMock('Magento\Framework\Config\ScopeInterface'),
67+
'Magento\Framework\Config\CacheInterface' => $this->getMock('Magento\Framework\Config\CacheInterface'),
68+
'Magento\Framework\Cache\FrontendInterface' =>
69+
$this->getMock('Magento\Framework\Cache\FrontendInterface'),
70+
'Magento\Framework\App\Resource' => $this->getMockBuilder('Magento\Framework\App\Resource')
71+
->disableOriginalConstructor()
72+
->getMock(),
73+
'Magento\Framework\App\Resource\Config' => $this->getMock(
74+
'Magento\Framework\App\Resource\Config',
75+
[],
76+
[],
77+
'',
78+
false
79+
)
80+
];
5981
$model = new \Magento\TestFramework\ObjectManager(
6082
$factory,
6183
$configMock,
62-
[
63-
'Magento\Framework\App\Cache\Type\Config' => $cache,
64-
'Magento\Framework\App\ObjectManager\ConfigLoader' => $configLoader,
65-
'Magento\Framework\App\ObjectManager\ConfigCache' => $configCache,
66-
'Magento\Framework\Config\ReaderInterface' => $this->getMock(
67-
'Magento\Framework\Config\ReaderInterface'
68-
),
69-
'Magento\Framework\Config\ScopeInterface' => $this->getMock('Magento\Framework\Config\ScopeInterface'),
70-
'Magento\Framework\Config\CacheInterface' => $this->getMock('Magento\Framework\Config\CacheInterface'),
71-
'Magento\Framework\Cache\FrontendInterface' =>
72-
$this->getMock('Magento\Framework\Cache\FrontendInterface'),
73-
'Magento\Framework\App\Resource' => $this->getMockBuilder('Magento\Framework\App\Resource')
74-
->disableOriginalConstructor()
75-
->getMock(),
76-
'Magento\Framework\App\Resource\Config' => $this->getMock(
77-
'Magento\Framework\App\Resource\Config',
78-
[],
79-
[],
80-
'',
81-
false
82-
)
83-
],
84+
$sharedInstances,
8485
$primaryLoaderMock
8586
);
8687

dev/tests/integration/testsuite/Magento/Framework/Interception/AbstractPlugin.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,20 @@ public function setUpInterceptionConfig($pluginConfig)
5252
$definitions
5353
);
5454
$interceptionDefinitions = new Definition\Runtime();
55+
$sharedInstances = [
56+
'Magento\Framework\Config\CacheInterface' => $cache,
57+
'Magento\Framework\Config\ScopeInterface' => $configScope,
58+
'Magento\Framework\Config\ReaderInterface' => $this->_configReader,
59+
'Magento\Framework\ObjectManager\RelationsInterface' => $relations,
60+
'Magento\Framework\ObjectManager\ConfigInterface' => $config,
61+
'Magento\Framework\Interception\ObjectManager\ConfigInterface' => $config,
62+
'Magento\Framework\ObjectManager\DefinitionInterface' => $definitions,
63+
'Magento\Framework\Interception\DefinitionInterface' => $interceptionDefinitions
64+
];
5565
$this->_objectManager = new \Magento\Framework\ObjectManager\ObjectManager(
5666
$factory,
5767
$config,
58-
[
59-
'Magento\Framework\Config\CacheInterface' => $cache,
60-
'Magento\Framework\Config\ScopeInterface' => $configScope,
61-
'Magento\Framework\Config\ReaderInterface' => $this->_configReader,
62-
'Magento\Framework\ObjectManager\RelationsInterface' => $relations,
63-
'Magento\Framework\ObjectManager\ConfigInterface' => $config,
64-
'Magento\Framework\Interception\ObjectManager\ConfigInterface' => $config,
65-
'Magento\Framework\ObjectManager\DefinitionInterface' => $definitions,
66-
'Magento\Framework\Interception\DefinitionInterface' => $interceptionDefinitions
67-
]
68+
$sharedInstances
6869
);
6970
$factory->setObjectManager($this->_objectManager);
7071
$config->setInterceptionConfig($interceptionConfig);

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Framework\ObjectManager\Environment;
77

8+
require 'CompiledTesting.php';
9+
810
class CompiledTest extends \PHPUnit_Framework_TestCase
911
{
1012
/**
@@ -15,7 +17,7 @@ class CompiledTest extends \PHPUnit_Framework_TestCase
1517
protected function setUp()
1618
{
1719
$envFactoryMock = $this->getMock('Magento\Framework\ObjectManager\EnvironmentFactory', [], [], '', false);
18-
$this->_compiled = new \Magento\Framework\ObjectManager\Environment\Compiled($envFactoryMock);
20+
$this->_compiled = new \Magento\Framework\ObjectManager\Environment\CompiledTesting($envFactoryMock);
1921
}
2022

2123
public function testGetFilePath()
@@ -27,4 +29,12 @@ public function testGetMode()
2729
{
2830
$this->assertEquals(Compiled::MODE, $this->_compiled->getMode());
2931
}
32+
33+
public function testGetObjectManagerFactory()
34+
{
35+
$this->assertInstanceOf(
36+
'Magento\Framework\ObjectManager\Factory\Compiled',
37+
$this->_compiled->getObjectManagerFactory(['shared_instances' => []])
38+
);
39+
}
3040
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Framework\ObjectManager\Environment;
8+
9+
require 'ConfigTesting.php';
10+
11+
class CompiledTesting extends Compiled
12+
{
13+
/**
14+
* @return array
15+
*/
16+
protected function getConfigData()
17+
{
18+
return [];
19+
}
20+
21+
/**
22+
* @return \Magento\Framework\Interception\ObjectManager\ConfigInterface
23+
*/
24+
public function getDiConfig()
25+
{
26+
return new ConfigTesting();
27+
}
28+
}
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Framework\ObjectManager\Environment;
7+
8+
use Magento\Framework\Interception\ObjectManager\ConfigInterface;
9+
use Magento\Framework\ObjectManager\ConfigCacheInterface;
10+
use Magento\Framework\ObjectManager\RelationsInterface;
11+
12+
class ConfigTesting implements ConfigInterface
13+
{
14+
15+
/**
16+
* Set class relations
17+
*
18+
* @param RelationsInterface $relations
19+
*
20+
* @return void
21+
*
22+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
23+
*/
24+
public function setRelations(RelationsInterface $relations)
25+
{
26+
return;
27+
}
28+
29+
/**
30+
* Set configuration cache instance
31+
*
32+
* @param ConfigCacheInterface $cache
33+
*
34+
* @return void
35+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
36+
*/
37+
public function setCache(ConfigCacheInterface $cache)
38+
{
39+
return;
40+
}
41+
42+
/**
43+
* Retrieve list of arguments per type
44+
*
45+
* @param string $type
46+
* @return array
47+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
48+
*/
49+
public function getArguments($type)
50+
{
51+
return [];
52+
}
53+
54+
/**
55+
* Check whether type is shared
56+
*
57+
* @param string $type
58+
* @return bool
59+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
60+
*/
61+
public function isShared($type)
62+
{
63+
return true;
64+
}
65+
66+
/**
67+
* Retrieve instance type
68+
*
69+
* @param string $instanceName
70+
* @return mixed
71+
*/
72+
public function getInstanceType($instanceName)
73+
{
74+
return $instanceName;
75+
}
76+
77+
/**
78+
* Retrieve preference for type
79+
*
80+
* @param string $type
81+
* @return string
82+
* @throws \LogicException
83+
*/
84+
public function getPreference($type)
85+
{
86+
return $type;
87+
}
88+
89+
/**
90+
* Returns list of virtual types
91+
*
92+
* @return array
93+
*/
94+
public function getVirtualTypes()
95+
{
96+
return [];
97+
}
98+
99+
/**
100+
* Extend configuration
101+
*
102+
* @param array $configuration
103+
* @return void
104+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
105+
*/
106+
public function extend(array $configuration)
107+
{
108+
return;
109+
}
110+
111+
/**
112+
* Returns list on preferences
113+
*
114+
* @return array
115+
*/
116+
public function getPreferences()
117+
{
118+
return [];
119+
}
120+
121+
/**
122+
* Set Interception config
123+
*
124+
* @param \Magento\Framework\Interception\ConfigInterface $interceptionConfig
125+
* @return void
126+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
127+
*/
128+
public function setInterceptionConfig(\Magento\Framework\Interception\ConfigInterface $interceptionConfig)
129+
{
130+
return;
131+
}
132+
133+
/**
134+
* Retrieve instance type without interception processing
135+
*
136+
* @param string $instanceName
137+
* @return string
138+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
139+
*/
140+
public function getOriginalInstanceType($instanceName)
141+
{
142+
return '';
143+
}
144+
}

0 commit comments

Comments
 (0)