Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/develop' into S67
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrii Kasian committed May 15, 2015
2 parents c2cab9a + a0ca082 commit 89b0bbb
Show file tree
Hide file tree
Showing 19 changed files with 467 additions and 485 deletions.
24 changes: 24 additions & 0 deletions app/code/Magento/Contact/Block/ContactForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Contact\Block;

use Magento\Framework\View\Element\Template;

/**
* Main contact form block
*/
class ContactForm extends Template
{
/**
* @param Template\Context $context
* @param array $data
*/
public function __construct(Template\Context $context, array $data = [])
{
parent::__construct($context, $data);
$this->_isScopePrivate = true;
}
}
44 changes: 44 additions & 0 deletions app/code/Magento/Contact/Test/Unit/Block/ContactFormTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Contact\Test\Unit\Block;

use Magento\Contact\Block\ContactForm;

class ContactFormTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Magento\Contact\Block\ContactForm
*/
protected $contactForm;

/**
* @var \Magento\Framework\View\Element\Template\Context|\PHPUnit_Framework_MockObject_MockObject
*/
protected $contextMock;

/**
* {@inheritDoc}
*/
protected function setUp()
{
$this->contextMock = $this->getMockBuilder('Magento\Framework\View\Element\Template\Context')
->disableOriginalConstructor()
->getMock();

$this->contactForm = new ContactForm(
$this->contextMock
);
}

/**
* @return void
*/
public function testScope()
{
$this->assertTrue($this->contactForm->isScopePrivate());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</head>
<body>
<referenceContainer name="content">
<block class="Magento\Framework\View\Element\Template" name="contactForm" template="Magento_Contact::form.phtml">
<block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
<container name="form.additional.info" label="Form Additional Info"/>
</block>
</referenceContainer>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/ImportExport/Model/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public function getOperationResultMessages($validationResult)
*/
public static function getAttributeType(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute)
{
if ($attribute->usesSource()) {
if ($attribute->usesSource() && in_array($attribute->getFrontendInput(), array('select', 'multiselect'))) {
return $attribute->getFrontendInput() == 'multiselect' ? 'multiselect' : 'select';
} elseif ($attribute->isStatic()) {
return $attribute->getFrontendInput() == 'date' ? 'datetime' : 'varchar';
Expand Down
137 changes: 0 additions & 137 deletions app/code/Magento/Reports/Block/Adminhtml/Product/Grid.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/**
* Adminhtml abandoned shopping carts report grid block
*
* @method \Magento\Reports\Model\Resource\Quote\Collection getCollection
*
* @author Magento Core Team <core@magentocommerce.com>
* @SuppressWarnings(PHPMD.DepthOfInheritance)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart
/**
* @var \Magento\Reports\Model\Resource\Quote\CollectionFactory
*/
protected $_quotesFactory;
protected $quoteItemCollectionFactory;

/**
* @var \Magento\Quote\Model\QueryResolver
Expand All @@ -26,18 +26,18 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart
/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Backend\Helper\Data $backendHelper
* @param \Magento\Reports\Model\Resource\Quote\CollectionFactoryInterface $quotesFactory
* @param \Magento\Reports\Model\Resource\Quote\Item\CollectionFactory $quoteItemCollectionFactory
* @param \Magento\Quote\Model\QueryResolver $queryResolver
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Backend\Helper\Data $backendHelper,
\Magento\Reports\Model\Resource\Quote\CollectionFactoryInterface $quotesFactory,
\Magento\Quote\Model\QueryResolver $queryResolver,
\Magento\Reports\Model\Resource\Quote\Item\CollectionFactory $quoteItemCollectionFactory,
array $data = []
) {
$this->_quotesFactory = $quotesFactory;
$this->quoteItemCollectionFactory = $quoteItemCollectionFactory;
$this->queryResolver = $queryResolver;
parent::__construct($context, $backendHelper, $data);
}
Expand All @@ -56,7 +56,8 @@ protected function _construct()
*/
protected function _prepareCollection()
{
$collection = $this->_quotesFactory->create();
/** @var \Magento\Reports\Model\Resource\Quote\Item\Collection $collection */
$collection = $this->quoteItemCollectionFactory->create();
$collection->prepareActiveCartItems();
$this->setCollection($collection);
return parent::_prepareCollection();
Expand All @@ -68,11 +69,11 @@ protected function _prepareCollection()
protected function _prepareColumns()
{
$this->addColumn(
'entity_id',
'product_id',
[
'header' => __('ID'),
'align' => 'right',
'index' => 'entity_id',
'index' => 'product_id',
'sortable' => false,
'header_css_class' => 'col-id',
'column_css_class' => 'col-id'
Expand Down Expand Up @@ -146,6 +147,6 @@ protected function _prepareColumns()
*/
public function getRowUrl($row)
{
return $this->getUrl('catalog/product/edit', ['id' => $row->getEntityId()]);
return $this->getUrl('catalog/product/edit', ['id' => $row->getProductId()]);
}
}
4 changes: 2 additions & 2 deletions app/code/Magento/Reports/Model/Resource/Order/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -900,8 +900,8 @@ public function addCreateAtPeriodFilter($period)
$this->addFieldToFilter(
$fieldToFilter,
[
'from' => $from->format(\Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT),
'to' => $to->format(\Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)
'from' => $from->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT),
'to' => $to->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT)
]
);

Expand Down
Loading

0 comments on commit 89b0bbb

Please sign in to comment.