Skip to content

Commit 05b2964

Browse files
author
Ganin, Roman(rganin)
committed
Merge pull request #290 from magento-troll/develop
[Troll] Bugfixes & Code quality improvements
2 parents e9378e4 + 520e354 commit 05b2964

File tree

18 files changed

+466
-484
lines changed

18 files changed

+466
-484
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Contact\Block;
7+
8+
use Magento\Framework\View\Element\Template;
9+
10+
/**
11+
* Main contact form block
12+
*/
13+
class ContactForm extends Template
14+
{
15+
/**
16+
* @param Template\Context $context
17+
* @param array $data
18+
*/
19+
public function __construct(Template\Context $context, array $data = [])
20+
{
21+
parent::__construct($context, $data);
22+
$this->_isScopePrivate = true;
23+
}
24+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Contact\Test\Unit\Block;
8+
9+
use Magento\Contact\Block\ContactForm;
10+
11+
class ContactFormTest extends \PHPUnit_Framework_TestCase
12+
{
13+
/**
14+
* @var \Magento\Contact\Block\ContactForm
15+
*/
16+
protected $contactForm;
17+
18+
/**
19+
* @var \Magento\Framework\View\Element\Template\Context|\PHPUnit_Framework_MockObject_MockObject
20+
*/
21+
protected $contextMock;
22+
23+
/**
24+
* {@inheritDoc}
25+
*/
26+
protected function setUp()
27+
{
28+
$this->contextMock = $this->getMockBuilder('Magento\Framework\View\Element\Template\Context')
29+
->disableOriginalConstructor()
30+
->getMock();
31+
32+
$this->contactForm = new ContactForm(
33+
$this->contextMock
34+
);
35+
}
36+
37+
/**
38+
* @return void
39+
*/
40+
public function testScope()
41+
{
42+
$this->assertTrue($this->contactForm->isScopePrivate());
43+
}
44+
}

app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</head>
1212
<body>
1313
<referenceContainer name="content">
14-
<block class="Magento\Framework\View\Element\Template" name="contactForm" template="Magento_Contact::form.phtml">
14+
<block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
1515
<container name="form.additional.info" label="Form Additional Info"/>
1616
</block>
1717
</referenceContainer>

app/code/Magento/Reports/Block/Adminhtml/Product/Grid.php

Lines changed: 0 additions & 137 deletions
This file was deleted.

app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned/Grid.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
/**
99
* Adminhtml abandoned shopping carts report grid block
1010
*
11+
* @method \Magento\Reports\Model\Resource\Quote\Collection getCollection
12+
*
1113
* @author Magento Core Team <core@magentocommerce.com>
1214
* @SuppressWarnings(PHPMD.DepthOfInheritance)
1315
*/

app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart
1616
/**
1717
* @var \Magento\Reports\Model\Resource\Quote\CollectionFactory
1818
*/
19-
protected $_quotesFactory;
19+
protected $quoteItemCollectionFactory;
2020

2121
/**
2222
* @var \Magento\Quote\Model\QueryResolver
@@ -26,18 +26,18 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart
2626
/**
2727
* @param \Magento\Backend\Block\Template\Context $context
2828
* @param \Magento\Backend\Helper\Data $backendHelper
29-
* @param \Magento\Reports\Model\Resource\Quote\CollectionFactoryInterface $quotesFactory
29+
* @param \Magento\Reports\Model\Resource\Quote\Item\CollectionFactory $quoteItemCollectionFactory
3030
* @param \Magento\Quote\Model\QueryResolver $queryResolver
3131
* @param array $data
3232
*/
3333
public function __construct(
3434
\Magento\Backend\Block\Template\Context $context,
3535
\Magento\Backend\Helper\Data $backendHelper,
36-
\Magento\Reports\Model\Resource\Quote\CollectionFactoryInterface $quotesFactory,
3736
\Magento\Quote\Model\QueryResolver $queryResolver,
37+
\Magento\Reports\Model\Resource\Quote\Item\CollectionFactory $quoteItemCollectionFactory,
3838
array $data = []
3939
) {
40-
$this->_quotesFactory = $quotesFactory;
40+
$this->quoteItemCollectionFactory = $quoteItemCollectionFactory;
4141
$this->queryResolver = $queryResolver;
4242
parent::__construct($context, $backendHelper, $data);
4343
}
@@ -56,7 +56,8 @@ protected function _construct()
5656
*/
5757
protected function _prepareCollection()
5858
{
59-
$collection = $this->_quotesFactory->create();
59+
/** @var \Magento\Reports\Model\Resource\Quote\Item\Collection $collection */
60+
$collection = $this->quoteItemCollectionFactory->create();
6061
$collection->prepareActiveCartItems();
6162
$this->setCollection($collection);
6263
return parent::_prepareCollection();
@@ -68,11 +69,11 @@ protected function _prepareCollection()
6869
protected function _prepareColumns()
6970
{
7071
$this->addColumn(
71-
'entity_id',
72+
'product_id',
7273
[
7374
'header' => __('ID'),
7475
'align' => 'right',
75-
'index' => 'entity_id',
76+
'index' => 'product_id',
7677
'sortable' => false,
7778
'header_css_class' => 'col-id',
7879
'column_css_class' => 'col-id'
@@ -146,6 +147,6 @@ protected function _prepareColumns()
146147
*/
147148
public function getRowUrl($row)
148149
{
149-
return $this->getUrl('catalog/product/edit', ['id' => $row->getEntityId()]);
150+
return $this->getUrl('catalog/product/edit', ['id' => $row->getProductId()]);
150151
}
151152
}

app/code/Magento/Reports/Model/Resource/Order/Collection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,8 @@ public function addCreateAtPeriodFilter($period)
900900
$this->addFieldToFilter(
901901
$fieldToFilter,
902902
[
903-
'from' => $from->format(\Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT),
904-
'to' => $to->format(\Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)
903+
'from' => $from->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT),
904+
'to' => $to->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT)
905905
]
906906
);
907907

0 commit comments

Comments
 (0)