Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.3-develop' into js-files-locat…
Browse files Browse the repository at this point in the history
…ion-changed-2.3-develop
  • Loading branch information
hitesh-wagento committed Aug 24, 2018
2 parents 0ce439b + 6b7a9b3 commit 83a2966
Show file tree
Hide file tree
Showing 49 changed files with 597 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class AdvancedPricing extends \Magento\CatalogImportExport\Model\Export\Product
* @param \Magento\CatalogImportExport\Model\Export\RowCustomizerInterface $rowCustomizer
* @param ImportProduct\StoreResolver $storeResolver
* @param \Magento\Customer\Api\GroupRepositoryInterface $groupRepository
* @throws \Magento\Framework\Exception\LocalizedException
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
Expand Down Expand Up @@ -193,6 +192,7 @@ protected function initTypeModels()
* Export process
*
* @return string
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function export()
{
Expand Down Expand Up @@ -586,8 +586,8 @@ protected function getTierPrices(array $listSku, $table)
* Get Website code.
*
* @param int $websiteId
*
* @return string
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function _getWebsiteCode(int $websiteId): string
{
Expand Down Expand Up @@ -617,8 +617,9 @@ protected function _getWebsiteCode(int $websiteId): string
*
* @param int $groupId
* @param int $allGroups
*
* @return string
* @throws \Magento\Framework\Exception\LocalizedException
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
protected function _getCustomerGroupById(
int $groupId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Magento\CatalogImportExport\Model\Import\Product as ImportProduct;
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as ValidatorInterface;
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
use Magento\Framework\App\ResourceConnection;

/**
* Class AdvancedPricing
Expand Down Expand Up @@ -618,6 +617,7 @@ protected function processCountNewPrices(array $tierPrices)
* Get product entity link field
*
* @return string
* @throws \Exception
*/
private function getProductEntityLinkField()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function __construct($validators = [])
*
* @param array $value
* @return bool
* @throws \Zend_Validate_Exception
*/
public function isValid($value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,13 @@ protected function setUp()
]
);
$this->exportConfig = $this->createMock(\Magento\ImportExport\Model\Export\Config::class);
$this->productFactory = $this->createPartialMock(\Magento\Catalog\Model\ResourceModel\ProductFactory::class, [
$this->productFactory = $this->createPartialMock(
\Magento\Catalog\Model\ResourceModel\ProductFactory::class,
[
'create',
'getTypeId',
]);
]
);
$this->attrSetColFactory = $this->createPartialMock(
\Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory::class,
[
Expand Down Expand Up @@ -185,11 +188,14 @@ protected function setUp()
\Magento\CatalogImportExport\Model\Import\Product\StoreResolver::class
);
$this->groupRepository = $this->createMock(\Magento\Customer\Api\GroupRepositoryInterface::class);
$this->writer = $this->createPartialMock(\Magento\ImportExport\Model\Export\Adapter\AbstractAdapter::class, [
'setHeaderCols',
'writeRow',
'getContents',
]);
$this->writer = $this->createPartialMock(
\Magento\ImportExport\Model\Export\Adapter\AbstractAdapter::class,
[
'setHeaderCols',
'writeRow',
'getContents',
]
);
$constructorMethods = [
'initTypeModels',
'initAttributes',
Expand Down Expand Up @@ -347,6 +353,7 @@ protected function tearDown()
* @param $object
* @param $property
* @return mixed
* @throws \ReflectionException
*/
protected function getPropertyValue($object, $property)
{
Expand All @@ -362,6 +369,8 @@ protected function getPropertyValue($object, $property)
* @param $object
* @param $property
* @param $value
* @return mixed
* @throws \ReflectionException
*/
protected function setPropertyValue(&$object, $property, $value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ public function isValidAddMessagesCallDataProvider()
* @param object $object
* @param string $property
* @return mixed
* @throws \ReflectionException
*/
protected function getPropertyValue($object, $property)
{
Expand All @@ -363,6 +364,7 @@ protected function getPropertyValue($object, $property)
* @param string $property
* @param mixed $value
* @return object
* @throws \ReflectionException
*/
protected function setPropertyValue(&$object, $property, $value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ public function testGetEntityTypeCode()
* Test method validateRow against its result.
*
* @dataProvider validateRowResultDataProvider
* @param array $rowData
* @param string|null $behavior
* @param bool $expectedResult
* @throws \ReflectionException
*/
public function testValidateRowResult($rowData, $behavior, $expectedResult)
{
Expand All @@ -234,6 +238,10 @@ public function testValidateRowResult($rowData, $behavior, $expectedResult)
* Test method validateRow whether AddRowError is called.
*
* @dataProvider validateRowAddRowErrorCallDataProvider
* @param array $rowData
* @param string|null $behavior
* @param string $error
* @throws \ReflectionException
*/
public function testValidateRowAddRowErrorCall($rowData, $behavior, $error)
{
Expand Down Expand Up @@ -324,6 +332,13 @@ public function testSaveAdvancedPricing()
* Take into consideration different data and check relative internal calls.
*
* @dataProvider saveAndReplaceAdvancedPricesAppendBehaviourDataProvider
* @param array $data
* @param string $tierCustomerGroupId
* @param string $groupCustomerGroupId
* @param string $tierWebsiteId
* @param string $groupWebsiteId
* @param array $expectedTierPrices
* @throws \ReflectionException
*/
public function testSaveAndReplaceAdvancedPricesAppendBehaviourDataAndCalls(
$data,
Expand Down Expand Up @@ -956,6 +971,7 @@ public function processCountExistingPricesDataProvider()
* @param $object
* @param $property
* @return mixed
* @throws \ReflectionException
*/
protected function getPropertyValue($object, $property)
{
Expand All @@ -972,6 +988,8 @@ protected function getPropertyValue($object, $property)
* @param $object
* @param $property
* @param $value
* @return mixed
* @throws \ReflectionException
*/
protected function setPropertyValue(&$object, $property, $value)
{
Expand All @@ -989,8 +1007,8 @@ protected function setPropertyValue(&$object, $property, $value)
* @param object $object
* @param string $method
* @param array $args
*
* @return mixed the method result.
* @return mixed
* @throws \ReflectionException
*/
private function invokeMethod($object, $method, $args = [])
{
Expand All @@ -1007,6 +1025,7 @@ private function invokeMethod($object, $method, $args = [])
* @param array $methods
*
* @return \PHPUnit_Framework_MockObject_MockObject
* @throws \ReflectionException
*/
private function getAdvancedPricingMock($methods = [])
{
Expand Down
8 changes: 4 additions & 4 deletions app/code/Magento/Bundle/Model/Product/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,12 +534,12 @@ public function updateQtyOption($options, \Magento\Framework\DataObject $option,

foreach ($selections as $selection) {
if ($selection->getProductId() == $optionProduct->getId()) {
foreach ($options as &$option) {
if ($option->getCode() == 'selection_qty_' . $selection->getSelectionId()) {
foreach ($options as $quoteItemOption) {
if ($quoteItemOption->getCode() == 'selection_qty_' . $selection->getSelectionId()) {
if ($optionUpdateFlag) {
$option->setValue(intval($option->getValue()));
$quoteItemOption->setValue(intval($quoteItemOption->getValue()));
} else {
$option->setValue($value);
$quoteItemOption->setValue($value);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ public function getOption()
}

/**
* Retrieve formatted price
*
* @return string
*/
public function getFormatedPrice()
public function getFormattedPrice()
{
if ($option = $this->getOption()) {
return $this->_formatPrice(
Expand All @@ -120,6 +122,17 @@ public function getFormatedPrice()
return '';
}

/**
* @return string
*
* @deprecated
* @see getFormattedPrice()
*/
public function getFormatedPrice()
{
return $this->getFormattedPrice();
}

/**
* Return formated price
*
Expand Down
5 changes: 4 additions & 1 deletion app/code/Magento/Catalog/Block/Product/View/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
namespace Magento\Catalog\Block\Product\View;

use Magento\Catalog\Model\Product;

class Price extends \Magento\Framework\View\Element\Template
{
/**
Expand Down Expand Up @@ -37,7 +39,8 @@ public function __construct(
*/
public function getPrice()
{
/** @var Product $product */
$product = $this->_coreRegistry->registry('product');
return $product->getFormatedPrice();
return $product->getFormattedPrice();
}
}
17 changes: 15 additions & 2 deletions app/code/Magento/Catalog/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -1124,11 +1124,24 @@ public function getTierPrice($qty = null)
/**
* Get formatted by currency product price
*
* @return array || double
* @return array|double
*/
public function getFormattedPrice()
{
return $this->getPriceModel()->getFormattedPrice($this);
}

/**
* Get formatted by currency product price
*
* @return array|double
*
* @deprecated
* @see getFormattedPrice()
*/
public function getFormatedPrice()
{
return $this->getPriceModel()->getFormatedPrice($this);
return $this->getFormattedPrice();
}

/**
Expand Down
37 changes: 34 additions & 3 deletions app/code/Magento/Catalog/Model/Product/Type/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,14 +474,15 @@ public function getTierPriceCount($product)
*
* @param float $qty
* @param Product $product
*
* @return array|float
*/
public function getFormatedTierPrice($qty, $product)
public function getFormattedTierPrice($qty, $product)
{
$price = $product->getTierPrice($qty);
if (is_array($price)) {
foreach (array_keys($price) as $index) {
$price[$index]['formated_price'] = $this->priceCurrency->convertAndFormat(
$price[$index]['formatted_price'] = $this->priceCurrency->convertAndFormat(
$price[$index]['website_price']
);
}
Expand All @@ -492,15 +493,45 @@ public function getFormatedTierPrice($qty, $product)
return $price;
}

/**
* Get formatted by currency tier price
*
* @param float $qty
* @param Product $product
*
* @return array|float
*
* @deprecated
* @see getFormattedTierPrice()
*/
public function getFormatedTierPrice($qty, $product)
{
return $this->getFormattedTierPrice($qty, $product);
}

/**
* Get formatted by currency product price
*
* @param Product $product
* @return array|float
*/
public function getFormattedPrice($product)
{
return $this->priceCurrency->format($product->getFinalPrice());
}

/**
* Get formatted by currency product price
*
* @param Product $product
* @return array || float
*
* @deprecated
* @see getFormattedPrice()
*/
public function getFormatedPrice($product)
{
return $this->priceCurrency->format($product->getFinalPrice());
return $this->getFormattedPrice($product);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

<!--Create Store view -->
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
<waitForElementVisible selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="waitForStoreViewBtn"/>
<click selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="createStoreViewButton"/>
<waitForPageLoad stepKey="waitForProductPageLoad"/>
<selectOption userInput="Second Store" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="admin__field field<?php if ($_option->getIsRequire()) echo ' required _required' ?>">
<label class="label admin__field-label">
<?= $block->escapeHtml($_option->getTitle()) ?>
<?= /* @escapeNotVerified */ $block->getFormatedPrice() ?>
<?= /* @escapeNotVerified */ $block->getFormattedPrice() ?>
</label>
<div class="admin__field-control control">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// @codingStandardsIgnoreFile

?>
<?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\File */ ?>
<?php $_option = $block->getOption(); ?>
<?php $_fileInfo = $block->getFileInfo(); ?>
<?php $_fileExists = $_fileInfo->hasData() ? true : false; ?>
Expand Down Expand Up @@ -64,7 +65,7 @@ require(['prototype'], function(){
<div class="admin__field <?php if ($_option->getIsRequire()) echo ' required _required' ?>">
<label class="admin__field-label label">
<?= $block->escapeHtml($_option->getTitle()) ?>
<?= /* @escapeNotVerified */ $block->getFormatedPrice() ?>
<?= /* @escapeNotVerified */ $block->getFormattedPrice() ?>
</label>
<div class="admin__field-control control">
<?php if ($_fileExists): ?>
Expand Down
Loading

0 comments on commit 83a2966

Please sign in to comment.