Skip to content

Commit 1ba4c4e

Browse files
committed
Merge pull request #393 from magento-troll/MAGETWO-38540
[Troll] Code Quality And Rendering System Optimization
2 parents 108dec0 + b6badfe commit 1ba4c4e

File tree

51 files changed

+2563
-188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2563
-188
lines changed

app/code/Magento/Backend/Block/Template/Context.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ class Context extends \Magento\Framework\View\Element\Template\Context
6767
* @param \Magento\Framework\App\State $appState
6868
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
6969
* @param \Magento\Framework\View\Page\Config $pageConfig
70+
* @param \Magento\Framework\View\Element\Template\File\Resolver $resolver
71+
* @param \Magento\Framework\View\Element\Template\File\Validator $validator
7072
* @param \Magento\Framework\AuthorizationInterface $authorization
7173
* @param \Magento\Backend\Model\Session $backendSession
7274
* @param \Magento\Framework\Math\Random $mathRandom
@@ -99,6 +101,8 @@ public function __construct(
99101
\Magento\Framework\App\State $appState,
100102
\Magento\Store\Model\StoreManagerInterface $storeManager,
101103
\Magento\Framework\View\Page\Config $pageConfig,
104+
\Magento\Framework\View\Element\Template\File\Resolver $resolver,
105+
\Magento\Framework\View\Element\Template\File\Validator $validator,
102106
\Magento\Framework\AuthorizationInterface $authorization,
103107
\Magento\Backend\Model\Session $backendSession,
104108
\Magento\Framework\Math\Random $mathRandom,
@@ -133,7 +137,9 @@ public function __construct(
133137
$enginePool,
134138
$appState,
135139
$storeManager,
136-
$pageConfig
140+
$pageConfig,
141+
$resolver,
142+
$validator
137143
);
138144
}
139145

app/code/Magento/Backend/Block/Widget/Context.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,16 @@ class Context extends \Magento\Backend\Block\Template\Context
4949
* @param \Magento\Framework\View\TemplateEnginePool $enginePool
5050
* @param \Magento\Framework\App\State $appState
5151
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
52+
* @param \Magento\Framework\View\Page\Config $pageConfig
53+
* @param \Magento\Framework\View\Element\Template\File\Resolver $resolver
54+
* @param \Magento\Framework\View\Element\Template\File\Validator $validator
5255
* @param \Magento\Framework\AuthorizationInterface $authorization
5356
* @param \Magento\Backend\Model\Session $backendSession
5457
* @param \Magento\Framework\Math\Random $mathRandom
5558
* @param \Magento\Framework\Data\Form\FormKey $formKey
5659
* @param \Magento\Framework\Code\NameBuilder $nameBuilder
5760
* @param \Magento\Backend\Block\Widget\Button\ButtonList $buttonList
5861
* @param Button\ToolbarInterface $toolbar
59-
* @param \Magento\Framework\View\Page\Config $pageConfig
6062
*
6163
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
6264
*/
@@ -84,6 +86,8 @@ public function __construct(
8486
\Magento\Framework\App\State $appState,
8587
\Magento\Store\Model\StoreManagerInterface $storeManager,
8688
\Magento\Framework\View\Page\Config $pageConfig,
89+
\Magento\Framework\View\Element\Template\File\Resolver $resolver,
90+
\Magento\Framework\View\Element\Template\File\Validator $validator,
8791
\Magento\Framework\AuthorizationInterface $authorization,
8892
\Magento\Backend\Model\Session $backendSession,
8993
\Magento\Framework\Math\Random $mathRandom,
@@ -116,6 +120,8 @@ public function __construct(
116120
$appState,
117121
$storeManager,
118122
$pageConfig,
123+
$resolver,
124+
$validator,
119125
$authorization,
120126
$backendSession,
121127
$mathRandom,

app/code/Magento/Catalog/Block/Product/Context.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ class Context extends \Magento\Framework\View\Element\Template\Context
9494
* @param \Magento\Framework\View\TemplateEnginePool $enginePool
9595
* @param \Magento\Framework\App\State $appState
9696
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
97+
* @param \Magento\Framework\View\Page\Config $pageConfig
98+
* @param \Magento\Framework\View\Element\Template\File\Resolver $resolver
99+
* @param \Magento\Framework\View\Element\Template\File\Validator $validator
97100
* @param \Magento\Catalog\Model\Config $catalogConfig
98101
* @param \Magento\Framework\Registry $registry
99102
* @param \Magento\Tax\Helper\Data $taxHelper
@@ -105,7 +108,6 @@ class Context extends \Magento\Framework\View\Element\Template\Context
105108
* @param \Magento\Catalog\Helper\Image $imageHelper
106109
* @param ReviewRendererInterface $reviewRenderer
107110
* @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
108-
* @param \Magento\Framework\View\Page\Config $pageConfig
109111
*
110112
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
111113
*/
@@ -133,6 +135,8 @@ public function __construct(
133135
\Magento\Framework\App\State $appState,
134136
\Magento\Store\Model\StoreManagerInterface $storeManager,
135137
\Magento\Framework\View\Page\Config $pageConfig,
138+
\Magento\Framework\View\Element\Template\File\Resolver $resolver,
139+
\Magento\Framework\View\Element\Template\File\Validator $validator,
136140
\Magento\Catalog\Model\Config $catalogConfig,
137141
\Magento\Framework\Registry $registry,
138142
\Magento\Tax\Helper\Data $taxHelper,
@@ -179,7 +183,9 @@ public function __construct(
179183
$enginePool,
180184
$appState,
181185
$storeManager,
182-
$pageConfig
186+
$pageConfig,
187+
$resolver,
188+
$validator
183189
);
184190
}
185191

app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Actions.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Actions extends Generic implements TabInterface
1515
* Prepare content for tab
1616
*
1717
* @return \Magento\Framework\Phrase
18+
* @codeCoverageIgnore
1819
*/
1920
public function getTabLabel()
2021
{
@@ -25,6 +26,7 @@ public function getTabLabel()
2526
* Prepare title for tab
2627
*
2728
* @return \Magento\Framework\Phrase
29+
* @codeCoverageIgnore
2830
*/
2931
public function getTabTitle()
3032
{
@@ -35,6 +37,7 @@ public function getTabTitle()
3537
* Returns status flag about this tab can be showen or not
3638
*
3739
* @return bool
40+
* @codeCoverageIgnore
3841
*/
3942
public function canShowTab()
4043
{
@@ -45,6 +48,7 @@ public function canShowTab()
4548
* Returns status flag about this tab hidden or not
4649
*
4750
* @return bool
51+
* @codeCoverageIgnore
4852
*/
4953
public function isHidden()
5054
{

app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public function __construct(
4646
* Prepare content for tab
4747
*
4848
* @return \Magento\Framework\Phrase
49+
* @codeCoverageIgnore
4950
*/
5051
public function getTabLabel()
5152
{
@@ -56,6 +57,7 @@ public function getTabLabel()
5657
* Prepare title for tab
5758
*
5859
* @return \Magento\Framework\Phrase
60+
* @codeCoverageIgnore
5961
*/
6062
public function getTabTitle()
6163
{
@@ -66,6 +68,7 @@ public function getTabTitle()
6668
* Returns status flag about this tab can be showen or not
6769
*
6870
* @return bool
71+
* @codeCoverageIgnore
6972
*/
7073
public function canShowTab()
7174
{
@@ -76,6 +79,7 @@ public function canShowTab()
7679
* Returns status flag about this tab hidden or not
7780
*
7881
* @return bool
82+
* @codeCoverageIgnore
7983
*/
8084
public function isHidden()
8185
{

app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public function __construct(
6868
* Prepare content for tab
6969
*
7070
* @return \Magento\Framework\Phrase
71+
* @codeCoverageIgnore
7172
*/
7273
public function getTabLabel()
7374
{
@@ -78,6 +79,7 @@ public function getTabLabel()
7879
* Prepare title for tab
7980
*
8081
* @return \Magento\Framework\Phrase
82+
* @codeCoverageIgnore
8183
*/
8284
public function getTabTitle()
8385
{
@@ -88,6 +90,7 @@ public function getTabTitle()
8890
* Returns status flag about this tab can be showed or not
8991
*
9092
* @return bool
93+
* @codeCoverageIgnore
9194
*/
9295
public function canShowTab()
9396
{
@@ -98,6 +101,7 @@ public function canShowTab()
98101
* Returns status flag about this tab hidden or not
99102
*
100103
* @return bool
104+
* @codeCoverageIgnore
101105
*/
102106
public function isHidden()
103107
{

app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ protected function _isAllowed()
8686
*
8787
* @param string $dirtyRulesNoticeMessage
8888
* @return void
89+
* @codeCoverageIgnore
8990
*/
9091
public function setDirtyRulesNoticeMessage($dirtyRulesNoticeMessage)
9192
{

app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public function executeFull()
6060
* Get affected cache tags
6161
*
6262
* @return array
63+
* @codeCoverageIgnore
6364
*/
6465
public function getIdentities()
6566
{

app/code/Magento/CatalogRule/Model/Resource/Rule.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ public function __construct(
135135
* Initialize main table and table id field
136136
*
137137
* @return void
138+
* @codeCoverageIgnore
138139
*/
139140
protected function _construct()
140141
{

app/code/Magento/CatalogRule/Model/Resource/Rule/Collection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Collection extends \Magento\Rule\Model\Resource\Rule\Collection\AbstractCo
2424
* Set resource model
2525
*
2626
* @return void
27+
* @codeCoverageIgnore
2728
*/
2829
protected function _construct()
2930
{

app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class Price extends \Magento\Framework\Model\Resource\Db\AbstractDb
1717
* Initialize connection and define main table
1818
*
1919
* @return void
20+
* @codeCoverageIgnore
2021
*/
2122
protected function _construct()
2223
{

app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price/Collection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac
99
{
1010
/**
1111
* @return void
12+
* @codeCoverageIgnore
1213
*/
1314
protected function _construct()
1415
{

app/code/Magento/CatalogRule/Model/Rule.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ public function getNow()
270270
*
271271
* @param string $now
272272
* @return void
273+
* @codeCoverageIgnore
273274
*/
274275
public function setNow($now)
275276
{
@@ -425,6 +426,7 @@ protected function _getRulesFromProduct($dateTs, $websiteId, $customerGroupId, $
425426
*
426427
* @param int|array $productIds
427428
* @return void
429+
* @codeCoverageIgnore
428430
*/
429431
public function setProductsFilter($productIds)
430432
{
@@ -435,6 +437,7 @@ public function setProductsFilter($productIds)
435437
* Returns products filter
436438
*
437439
* @return array|int|null
440+
* @codeCoverageIgnore
438441
*/
439442
public function getProductsFilter()
440443
{

app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/Edit/FormTest.php

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,6 @@ class FormTest extends \PHPUnit_Framework_TestCase
9090
*/
9191
protected $appState;
9292

93-
/**
94-
* @var \PHPUnit_Framework_MockObject_MockObject
95-
*/
96-
protected $viewFileSystem;
97-
9893
/**
9994
* @var \PHPUnit_Framework_MockObject_MockObject
10095
*/
@@ -130,6 +125,16 @@ class FormTest extends \PHPUnit_Framework_TestCase
130125
*/
131126
protected $block;
132127

128+
/**
129+
* @var \Magento\Framework\View\Element\Template\File\Resolver|\PHPUnit_Framework_MockObject_MockObject
130+
*/
131+
protected $_resolver;
132+
133+
/**
134+
* @var \Magento\Framework\View\Element\Template\File\Validator|\PHPUnit_Framework_MockObject_MockObject
135+
*/
136+
protected $_validator;
137+
133138
/**
134139
* Sets up the fixture, for example, open a network connection.
135140
* This method is called before a test is executed.
@@ -138,6 +143,22 @@ class FormTest extends \PHPUnit_Framework_TestCase
138143
*/
139144
public function setUp()
140145
{
146+
$this->_resolver = $this->getMock(
147+
'Magento\Framework\View\Element\Template\File\Resolver',
148+
[],
149+
[],
150+
'',
151+
false
152+
);
153+
154+
$this->_validator = $this->getMock(
155+
'Magento\Framework\View\Element\Template\File\Validator',
156+
[],
157+
[],
158+
'',
159+
false
160+
);
161+
141162
$this->model = $this->getMock('Magento\Cms\Model\Block', ['getBlockId', 'setStoreId'], [], '', false);
142163

143164
$this->registry = $this->getMock('Magento\Framework\Registry', [], [], '', false);
@@ -158,7 +179,6 @@ public function setUp()
158179
$this->scopeConfig = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface', [], [], '', false);
159180
$this->urlBuilder = $this->getMock('Magento\Framework\UrlInterface', [], [], '', false);
160181
$this->appState = $this->getMock('Magento\Framework\App\State', [], [], '', false);
161-
$this->viewFileSystem = $this->getMock('Magento\Framework\View\FileSystem', [], [], '', false);
162182
$this->logger = $this->getMock('Psr\Log\LoggerInterface', [], [], '', false);
163183
$this->rootDirectory = $this->getMock(
164184
'Magento\Framework\Filesystem\Directory\ReadInterface',
@@ -193,10 +213,11 @@ public function setUp()
193213
$this->context->expects($this->once())->method('getStoreManager')->willReturn($this->storeManager);
194214
$this->context->expects($this->once())->method('getUrlBuilder')->willReturn($this->urlBuilder);
195215
$this->context->expects($this->once())->method('getAppState')->willReturn($this->appState);
196-
$this->context->expects($this->once())->method('getViewFileSystem')->willReturn($this->viewFileSystem);
197216
$this->context->expects($this->once())->method('getFilesystem')->willReturn($this->fileSystem);
198217
$this->context->expects($this->once())->method('getLogger')->willReturn($this->logger);
199218
$this->context->expects($this->once())->method('getLayout')->willReturn($this->layout);
219+
$this->context->expects($this->once())->method('getResolver')->willReturn($this->_resolver);
220+
$this->context->expects($this->once())->method('getValidator')->willReturn($this->_validator);
200221

201222
/** @var \Magento\Cms\Block\Adminhtml\Block\Edit\Form $block */
202223
$this->block = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))

app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function getGridUrl()
204204
*/
205205
public function getGridParentHtml()
206206
{
207-
$templateName = $this->_viewFileSystem->getTemplateFileName($this->_parentTemplate, ['_relative' => true]);
207+
$templateName = $this->resolver->getTemplateFileName($this->_parentTemplate, ['_relative' => true]);
208208
return $this->fetchView($templateName);
209209
}
210210

0 commit comments

Comments
 (0)