File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Test/Unit/Model/PageLayout/Config Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,11 @@ class Builder implements \Magento\Framework\View\Model\PageLayout\Config\Builder
27
27
*/
28
28
protected $ themeCollection ;
29
29
30
+ /**
31
+ * @var array
32
+ */
33
+ private $ configFiles = [];
34
+
30
35
/**
31
36
* @param \Magento\Framework\View\PageLayout\ConfigFactory $configFactory
32
37
* @param \Magento\Framework\View\PageLayout\File\Collector\Aggregated $fileCollector
@@ -56,11 +61,14 @@ public function getPageLayoutsConfig()
56
61
*/
57
62
protected function getConfigFiles ()
58
63
{
59
- $ configFiles = [];
60
- foreach ($ this ->themeCollection ->loadRegisteredThemes () as $ theme ) {
61
- $ configFiles = array_merge ($ configFiles , $ this ->fileCollector ->getFilesContent ($ theme , 'layouts.xml ' ));
64
+ if (empty ($ this ->configFiles )) {
65
+ $ configFiles = [];
66
+ foreach ($ this ->themeCollection ->loadRegisteredThemes () as $ theme ) {
67
+ $ configFiles [] = $ this ->fileCollector ->getFilesContent ($ theme , 'layouts.xml ' );
68
+ }
69
+ $ this ->configFiles = array_merge (...$ configFiles );
62
70
}
63
71
64
- return $ configFiles ;
72
+ return $ this -> configFiles ;
65
73
}
66
74
}
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ public function testGetPageLayoutsConfig()
83
83
->disableOriginalConstructor ()
84
84
->getMock ();
85
85
86
- $ this ->themeCollection ->expects ($ this ->any ())
86
+ $ this ->themeCollection ->expects ($ this ->once ())
87
87
->method ('loadRegisteredThemes ' )
88
88
->willReturn ([$ theme1 , $ theme2 ]);
89
89
You can’t perform that action at this time.
0 commit comments