11
11
* Class GeneralTest
12
12
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
13
13
*/
14
- class GeneralTest extends \PHPUnit_Framework_TestCase
14
+ class GeneralTest extends AbstractPlugin
15
15
{
16
16
/**
17
17
* @var \PHPUnit_Framework_MockObject_MockObject
@@ -27,80 +27,24 @@ public function setUp()
27
27
{
28
28
$ this ->setUpInterceptionConfig (
29
29
[
30
- 'Magento\Framework\Interception\Fixture\InterceptedInterface ' => [
31
- 'plugins ' => [
32
- 'first ' => [
33
- 'instance ' => 'Magento\Framework\Interception\Fixture\Intercepted\InterfacePlugin ' ,
34
- 'sortOrder ' => 10 ,
30
+ 'Magento\Framework\Interception\Fixture\InterceptedInterface ' =>
31
+ [
32
+ 'plugins ' => [
33
+ 'first ' => [
34
+ 'instance ' => 'Magento\Framework\Interception\Fixture\Intercepted\InterfacePlugin ' ,
35
+ 'sortOrder ' => 10 ,
36
+ ],
35
37
],
36
38
],
37
- ],
38
- 'Magento\Framework\Interception\Fixture\Intercepted ' => [
39
- 'plugins ' => [
40
- 'second ' => [
41
- 'instance ' => 'Magento\Framework\Interception\Fixture\Intercepted\Plugin ' ,
42
- 'sortOrder ' => 20 ,
39
+ 'Magento\Framework\Interception\Fixture\Intercepted ' =>
40
+ [
41
+ 'plugins ' => [
42
+ 'second ' => [
43
+ 'instance ' => 'Magento\Framework\Interception\Fixture\Intercepted\Plugin ' ,
44
+ 'sortOrder ' => 20 ,
45
+ ],
43
46
],
44
47
],
45
- ],
46
- ]
47
- );
48
- }
49
-
50
- public function setUpInterceptionConfig ($ pluginConfig )
51
- {
52
- $ config = new \Magento \Framework \Interception \ObjectManager \Config \Developer ();
53
- $ factory = new \Magento \Framework \ObjectManager \Factory \Dynamic \Developer ($ config , null );
54
-
55
- $ this ->_configReader = $ this ->getMock ('Magento\Framework\Config\ReaderInterface ' );
56
- $ this ->_configReader ->expects (
57
- $ this ->any ()
58
- )->method (
59
- 'read '
60
- )->will (
61
- $ this ->returnValue ($ pluginConfig )
62
- );
63
-
64
- $ areaList = $ this ->getMock ('Magento\Framework\App\AreaList ' , [], [], '' , false );
65
- $ areaList ->expects ($ this ->any ())->method ('getCodes ' )->will ($ this ->returnValue ([]));
66
- $ configScope = new \Magento \Framework \Config \Scope ($ areaList , 'global ' );
67
- $ cache = $ this ->getMock ('Magento\Framework\Config\CacheInterface ' );
68
- $ cache ->expects ($ this ->any ())->method ('load ' )->will ($ this ->returnValue (false ));
69
- $ definitions = new \Magento \Framework \ObjectManager \Definition \Runtime ();
70
- $ relations = new \Magento \Framework \ObjectManager \Relations \Runtime ();
71
- $ interceptionConfig = new Config \Config (
72
- $ this ->_configReader ,
73
- $ configScope ,
74
- $ cache ,
75
- $ relations ,
76
- $ config ,
77
- $ definitions
78
- );
79
- $ interceptionDefinitions = new Definition \Runtime ();
80
- $ this ->_objectManager = new \Magento \Framework \ObjectManager \ObjectManager (
81
- $ factory ,
82
- $ config ,
83
- [
84
- 'Magento\Framework\Config\CacheInterface ' => $ cache ,
85
- 'Magento\Framework\Config\ScopeInterface ' => $ configScope ,
86
- 'Magento\Framework\Config\ReaderInterface ' => $ this ->_configReader ,
87
- 'Magento\Framework\ObjectManager\RelationsInterface ' => $ relations ,
88
- 'Magento\Framework\ObjectManager\ConfigInterface ' => $ config ,
89
- 'Magento\Framework\Interception\ObjectManager\ConfigInterface ' => $ config ,
90
- 'Magento\Framework\ObjectManager\DefinitionInterface ' => $ definitions ,
91
- 'Magento\Framework\Interception\DefinitionInterface ' => $ interceptionDefinitions
92
- ]
93
- );
94
- $ factory ->setObjectManager ($ this ->_objectManager );
95
- $ config ->setInterceptionConfig ($ interceptionConfig );
96
- $ config ->extend (
97
- [
98
- 'preferences ' => [
99
- 'Magento\Framework\Interception\PluginListInterface ' =>
100
- 'Magento\Framework\Interception\PluginList\PluginList ' ,
101
- 'Magento\Framework\Interception\ChainInterface ' =>
102
- 'Magento\Framework\Interception\Chain\Chain ' ,
103
- ],
104
48
]
105
49
);
106
50
}
0 commit comments