Skip to content

Commit

Permalink
Merge remote-tracking branch 'main/develop' into epam-3-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Konosov committed Jun 10, 2015
2 parents 4ed7a68 + a4d4b22 commit bac1f10
Show file tree
Hide file tree
Showing 305 changed files with 2,387 additions and 963 deletions.
4 changes: 2 additions & 2 deletions app/code/Magento/AdminNotification/Model/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Feed extends \Magento\Framework\Model\AbstractModel
* @param \Magento\Framework\App\ProductMetadataInterface $productMetadata
* @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
Expand All @@ -87,7 +87,7 @@ public function __construct(
\Magento\Framework\App\ProductMetadataInterface $productMetadata,
\Magento\Framework\UrlInterface $urlBuilder,
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Backend/Helper/Dashboard/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
/**
* @var \Magento\Framework\Data\Collection\Db
* @var \MagentoFrameworkDataCollectionAbstractDb
*/
protected $_stores;

Expand Down Expand Up @@ -48,7 +48,7 @@ public function __construct(
/**
* Retrieve stores configured in system.
*
* @return \Magento\Framework\Data\Collection\Db
* @return \MagentoFrameworkDataCollectionAbstractDb
*/
public function getStores()
{
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Backup/Model/Config/Backend/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Cron extends \Magento\Framework\App\Config\Value
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
* @param \Magento\Framework\App\Config\ValueFactory $configValueFactory
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param string $runModelPath
* @param array $data
*/
Expand All @@ -44,7 +44,7 @@ public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $config,
\Magento\Framework\App\Config\ValueFactory $configValueFactory,
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
$runModelPath = '',
array $data = []
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Creditmemo extends AbstractItems
* @param \Magento\Framework\Filter\FilterManager $filterManager
* @param \Magento\Framework\Stdlib\String $string
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data
*/
public function __construct(
Expand All @@ -36,7 +36,7 @@ public function __construct(
\Magento\Framework\Filter\FilterManager $filterManager,
\Magento\Framework\Stdlib\String $string,
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
$this->string = $string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Invoice extends AbstractItems
* @param \Magento\Framework\Filter\FilterManager $filterManager
* @param \Magento\Framework\Stdlib\String $coreString
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data
*/
public function __construct(
Expand All @@ -37,7 +37,7 @@ public function __construct(
\Magento\Framework\Filter\FilterManager $filterManager,
\Magento\Framework\Stdlib\String $coreString,
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
$this->string = $coreString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Shipment extends AbstractItems
* @param \Magento\Framework\Filter\FilterManager $filterManager
* @param \Magento\Framework\Stdlib\String $string
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data
*/
public function __construct(
Expand All @@ -34,7 +34,7 @@ public function __construct(
\Magento\Framework\Filter\FilterManager $filterManager,
\Magento\Framework\Stdlib\String $string,
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
$this->string = $string;
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Bundle/Model/Selection.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ class Selection extends \Magento\Framework\Model\AbstractModel
* @param \Magento\Framework\Registry $registry
* @param \Magento\Catalog\Helper\Data $catalogData
* @param \Magento\Bundle\Model\Resource\Selection $resource
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data
*/
public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Catalog\Helper\Data $catalogData,
\Magento\Bundle\Model\Resource\Selection $resource,
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
$this->_catalogData = $catalogData;
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Bundle/Model/Source/Option/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Type extends \Magento\Framework\Model\AbstractExtensibleModel implements
* @param AttributeValueFactory $customAttributeFactory
* @param array $options
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data
*/
public function __construct(
Expand All @@ -48,7 +48,7 @@ public function __construct(
AttributeValueFactory $customAttributeFactory,
array $options,
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
$this->options = $options;
Expand Down
78 changes: 60 additions & 18 deletions app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,11 @@ public function testSaveIfOptionIdIsNull()
$optionMock->expects($this->once())->method('setParentId')->with($productId)->willReturnSelf();

$optionIdsMap = [null, $optionId, $optionId];
$optionMock->expects($this->any())->method('getOptionId')->willReturnCallback(function () use (&$optionIdsMap) {
return array_shift($optionIdsMap);
});
$optionMock->expects($this->any())->method('getOptionId')->willReturnCallback(
function () use (&$optionIdsMap) {
return array_shift($optionIdsMap);
}
);
$optionMock->expects($this->exactly(2))->method('getProductLinks')->willReturn([$linkedProductMock]);

$this->optionResourceMock->expects($this->once())->method('save')->with($optionMock)->willReturnSelf();
Expand Down Expand Up @@ -364,21 +366,8 @@ public function testSaveExistingOption()
$productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);
$productMock->expects($this->once())->method('getId')->willReturn($productId);
$productMock->expects($this->any())->method('getSku')->willReturn($productSku);
$optionMock = $this->getMock(
'\Magento\Bundle\Model\Option',
[
'setStoreId',
'setParentId',
'getProductLinks',
'getOptionId',
'setOptionId',
'setDefaultTitle',
'getTitle'
],
[],
'',
false
);

$optionMock = $this->createOptionMock();
$optionMock->expects($this->once())->method('setStoreId')->with($storeId)->willReturnSelf();
$optionMock->expects($this->once())->method('setParentId')->with($productId)->willReturnSelf();
$optionMock->expects($this->any())->method('getOptionId')->willReturn($optionId);
Expand Down Expand Up @@ -613,4 +602,57 @@ public function testGetListException()
->willReturn($productMock);
$this->assertEquals(['object'], $this->model->getList($productSku));
}

/**
* @return \PHPUnit_Framework_MockObject_MockObject
*/
private function createOptionMock()
{
$contextMock = $this->getMock('Magento\Framework\Model\Context', [], [], '', false);
$registryMock = $this->getMock('Magento\Framework\Registry', [], [], '', false);
$extensionAttributesFactory = $this->getMock(
'Magento\Framework\Api\ExtensionAttributesFactory',
[],
[],
'',
false
);
$attributeValueFactoryMock = $this->getMock('Magento\Framework\Api\AttributeValueFactory', [], [], '', false);
$resourceMock = $this->getMock(
'Magento\Framework\Model\Resource\Db\AbstractDb',
[
'_construct',
'getIdFieldName'
],
[],
'',
false
);
$resourceCollectionMock = $this->getMockBuilder('Magento\Framework\Data\Collection\AbstractDb')
->disableOriginalConstructor()
->getMockForAbstractClass();
$optionMock = $this->getMock(
'Magento\Bundle\Model\Option',
[
'setStoreId',
'setParentId',
'getProductLinks',
'getOptionId',
'setOptionId',
'setDefaultTitle',
'getTitle'
],
[
$contextMock,
$registryMock,
$extensionAttributesFactory,
$attributeValueFactoryMock,
$resourceMock,
$resourceCollectionMock
],
'',
true
);
return $optionMock;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ protected function createOptionMock($optionData)
foreach ($optionData['selections'] as $selectionData) {
$selections[] = $this->createSelectionMock($selectionData);
}
$option->setData($optionData['data']);
foreach ($optionData['data'] as $key => $value) {
$option->setData($key, $value);
}
$option->setData('selections', $selections);
return $option;
}
Expand All @@ -230,7 +232,9 @@ protected function createSelectionMock($selectionData)

// All items are saleable
$selection->expects($this->any())->method('isSalable')->will($this->returnValue(true));
$selection->setData($selectionData['data']);
foreach ($selectionData['data'] as $key => $value) {
$selection->setData($key, $value);
}
$amountMock = $this->createAmountMock($selectionData['amount']);
$selection->expects($this->any())->method('getAmount')->will($this->returnValue($amountMock));
$selection->expects($this->any())->method('getQuantity')->will($this->returnValue(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ protected function createOptionMock($optionData)
foreach ($optionData['selections'] as $selectionData) {
$selections[] = $this->createSelectionMock($selectionData);
}
$option->setData($optionData['data']);
foreach ($optionData['data'] as $key => $value) {
$option->setData($key, $value);
}
$option->setData('selections', $selections);
return $option;
}
Expand All @@ -262,7 +264,9 @@ protected function createSelectionMock($selectionData)

// All items are saleable
$selection->expects($this->any())->method('isSalable')->will($this->returnValue(true));
$selection->setData($selectionData['data']);
foreach ($selectionData['data'] as $key => $value) {
$selection->setData($key, $value);
}
$amountMock = $this->createAmountMock($selectionData['amount']);
$selection->expects($this->any())->method('getAmount')->will($this->returnValue($amountMock));
$selection->expects($this->any())->method('getQuantity')->will($this->returnValue(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/service_data_attributes.xsd">
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/extension_attributes.xsd">
<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
<attribute code="bundle_product_options" type="Magento\Bundle\Api\Data\OptionInterface[]" />
</extension_attributes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/service_data_attributes.xsd">
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/extension_attributes.xsd">
<extension_attributes for="Magento\Quote\Api\Data\AddressAdditionalDataInterface">
<attribute code="captcha_string" type="string" />
<attribute code="captcha_form_id" type="string" />
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/Model/AbstractModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ abstract class AbstractModel extends \Magento\Framework\Model\AbstractExtensible
* @param AttributeValueFactory $customAttributeFactory
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data
*/
public function __construct(
Expand All @@ -76,7 +76,7 @@ public function __construct(
AttributeValueFactory $customAttributeFactory,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
$this->_storeManager = $storeManager;
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/Catalog/Model/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
* @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
* @param CategoryRepositoryInterface $categoryRepository
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
Expand All @@ -258,7 +258,7 @@ public function __construct(
\Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
CategoryRepositoryInterface $categoryRepository,
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
$this->metadataService = $metadataService;
Expand Down Expand Up @@ -451,7 +451,7 @@ public function getDefaultAttributeSetId()
/**
* Get category products collection
*
* @return \Magento\Framework\Data\Collection\Db
* @return \Magento\Framework\Data\Collection\AbstractDb
*/
public function getProductCollection()
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/CategoryLinkManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getAssignedProducts($categoryId)
$category = $this->categoryRepository->get($categoryId);
$productsPosition = $category->getProductsPosition();

/** @var \Magento\Framework\Data\Collection\Db $products */
/** @var \Magento\Framework\Data\Collection\AbstractDb $products */
$products = $category->getProductCollection();

/** @var \Magento\Catalog\Api\Data\CategoryProductLinkInterface[] $links */
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/Model/Config/Backend/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Category extends \Magento\Framework\App\Config\Value
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
* @param \Magento\Catalog\Model\Category $catalogCategory
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data
*/
public function __construct(
Expand All @@ -36,7 +36,7 @@ public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $config,
\Magento\Catalog\Model\Category $catalogCategory,
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
$this->_catalogCategory = $catalogCategory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Image extends \Magento\Framework\App\Config\Value
* @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory
* @param \Magento\Eav\Model\Config $eavConfig
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data
*/
public function __construct(
Expand All @@ -43,7 +43,7 @@ public function __construct(
\Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory,
\Magento\Eav\Model\Config $eavConfig,
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\Db $resourceCollection = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
$this->_attributeCollectionFactory = $attributeCollectionFactory;
Expand Down
Loading

0 comments on commit bac1f10

Please sign in to comment.