@@ -42,15 +42,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
42
42
43
43
protected function setUp ()
44
44
{
45
- $ this ->readerMock = $ this ->getMock ('Magento\Framework\Module\Dir\Reader ' , [], [], '' , false );
46
45
$ this ->filesystemMock = $ this ->getMock ('Magento\Framework\Filesystem ' , [], [], '' , false );
47
46
$ this ->directoryReadMock = $ this ->getMock ('Magento\Framework\Filesystem\Directory\ReadInterface ' );
48
- $ this ->filesystemMock ->expects ($ this ->once ())
49
- ->method ('getDirectoryRead ' )
50
- ->with ($ this ->equalTo (DirectoryList::ROOT ))
51
- ->will ($ this ->returnValue ($ this ->directoryReadMock ));
52
47
$ this ->repositoryMock = $ this ->getMock ('Magento\Framework\View\Asset\Repository ' , [], [], '' , false );
53
- $ this ->fileSystemMock = $ this ->getMock ('Magento\Framework\View\FileSystem ' , [], [], '' , false );
54
48
$ this ->fileIteratorFactoryMock = $ this ->getMock (
55
49
'Magento\Framework\Config\FileIteratorFactory ' ,
56
50
[],
@@ -63,10 +57,7 @@ protected function setUp()
63
57
$ this ->config = $ this ->objectManagerHelper ->getObject (
64
58
'Magento\Framework\View\Config ' ,
65
59
[
66
- 'moduleReader ' => $ this ->readerMock ,
67
- 'filesystem ' => $ this ->filesystemMock ,
68
60
'assetRepo ' => $ this ->repositoryMock ,
69
- 'viewFileSystem ' => $ this ->fileSystemMock ,
70
61
'fileIteratorFactory ' => $ this ->fileIteratorFactoryMock ,
71
62
'viewConfigFactory ' => $ this ->viewConfigFactoryMock
72
63
]
@@ -77,55 +68,15 @@ public function testGetViewConfig()
77
68
{
78
69
$ themeMock = $ this ->getMock (
79
70
'Magento\Theme\Model\Theme ' ,
80
- ['getCode ' , ' getCustomization ' , ' getCustomViewConfigPath ' ],
71
+ ['getCustomViewConfigPath ' ],
81
72
[],
82
73
'' ,
83
74
false
84
75
);
85
- $ themeMock ->expects ($ this ->atLeastOnce ())
86
- ->method ('getCode ' )
87
- ->will ($ this ->returnValue (2 ));
88
- $ themeMock ->expects ($ this ->once ())
89
- ->method ('getCustomization ' )
90
- ->will ($ this ->returnSelf ());
91
- $ themeMock ->expects ($ this ->once ())
92
- ->method ('getCustomViewConfigPath ' )
93
- ->will ($ this ->returnValue ('' ));
94
76
$ params = ['themeModel ' => $ themeMock ];
95
- $ configFile = 'config.xml ' ;
96
- $ this ->repositoryMock ->expects ($ this ->atLeastOnce ())
97
- ->method ('updateDesignParams ' )
98
- ->with ($ this ->equalTo ($ params ))
99
- ->will ($ this ->returnSelf ());
100
- $ iterator = $ this ->getMock ('Magento\Framework\Config\FileIterator ' , [], [], '' , false );
101
- $ iterator ->expects ($ this ->once ())
102
- ->method ('toArray ' )
103
- ->will ($ this ->returnValue ([]));
104
- $ this ->readerMock ->expects ($ this ->once ())
105
- ->method ('getConfigurationFiles ' )
106
- ->with ($ this ->equalTo (basename (\Magento \Framework \View \ConfigInterface::CONFIG_FILE_NAME )))
107
- ->will ($ this ->returnValue ($ iterator ));
108
- $ this ->directoryReadMock ->expects ($ this ->once ())
109
- ->method ('isExist ' )
110
- ->with ($ this ->anything ())
111
- ->will ($ this ->returnValue (true ));
112
- $ this ->fileSystemMock ->expects ($ this ->once ())
113
- ->method ('getFilename ' )
114
- ->with ($ this ->equalTo (\Magento \Framework \View \ConfigInterface::CONFIG_FILE_NAME ), $ params )
115
- ->will ($ this ->returnValue ($ configFile ));
116
- $ this ->directoryReadMock ->expects ($ this ->any ())
117
- ->method ('getRelativePath ' )
118
- ->with ($ this ->equalTo ($ configFile ))
119
- ->will ($ this ->returnArgument (0 ));
120
- $ xmlData = '<view><vars module="Magento_Catalog"><var name="test">1</var></vars></view> ' ;
121
- $ this ->directoryReadMock ->expects ($ this ->once ())
122
- ->method ('readFile ' )
123
- ->with ($ this ->equalTo ($ configFile ))
124
- ->will ($ this ->returnValue ($ xmlData ));
125
77
$ configViewMock = $ this ->getMock ('Magento\Framework\Config\View ' , [], [], '' , false );
126
78
$ this ->viewConfigFactoryMock ->expects ($ this ->once ())
127
79
->method ('create ' )
128
- ->with ([$ configFile => $ xmlData ])
129
80
->willReturn ($ configViewMock );
130
81
$ this ->assertInstanceOf ('Magento\Framework\Config\View ' , $ this ->config ->getViewConfig ($ params ));
131
82
// lazy load test
0 commit comments