Skip to content

Commit

Permalink
Merge pull request #1375 from magento-mpi/pr-regression-ece
Browse files Browse the repository at this point in the history
[MPI] Bugfixes
  • Loading branch information
viktym authored Aug 2, 2017
2 parents f37598e + f17a1c2 commit 9badb94
Show file tree
Hide file tree
Showing 27 changed files with 362 additions and 108 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@
class ActiveTableSwitcher
{
/**
* @var
* Suffix for replica index table.
*
* @var string
* @since 2.2.0
*/
private $additionalTableSuffix = '_replica';

/**
* @var
* Suffix for outdated index table.
*
* @var string
* @since 2.2.0
*/
private $outdatedTableSuffix = '_outdated';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Custom extends \Magento\Framework\App\Config\Value
const XML_PATH_PAYMENT = 'payment';

/**
* @var
* @var \Magento\Framework\App\Config\Storage\WriterInterface
* @since 2.0.0
*/
protected $_configWriter;
Expand Down
6 changes: 4 additions & 2 deletions app/code/Magento/Deploy/Model/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ public function cleanupFilesystem($directoryCodeList)
* @param int $dirPermissions
* @param int $filePermissions
* @return void
* @deprecated 2.1.0 As magento2 doesn't control indirectly the access permissions to the files and directories anymore.
* @deprecated 2.1.0 As magento2 doesn't control indirectly
* the access permissions to the files and directories anymore.
* Access permissions to the files and directories are set during deploy Magento 2, directly after
* uploading code of Magento. Also it is possible to specify the value
* of inverse mask for setting access permissions to files and directories generated by Magento.
Expand All @@ -350,7 +351,8 @@ protected function changePermissions($directoryCodeList, $dirPermissions, $fileP
* Change permissions on static resources
*
* @return void
* @deprecated 2.1.0 As magento2 doesn't control indirectly the access permissions to the files and directories anymore.
* @deprecated 2.1.0 As magento2 doesn't control indirectly the access permissions to the files
* and directories anymore.
* Access permissions to the files and directories are set during deploy Magento 2, directly after
* uploading code of Magento. Also it is possible to specify the value
* of inverse mask for setting access permissions to files and directories generated by Magento.
Expand Down
10 changes: 5 additions & 5 deletions app/code/Magento/Dhl/Model/Carrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ protected function _getWeight($weight, $maxWeight = false, $configWeightUnit = f

if ($configWeightUnit != $countryWeightUnit) {
$weight = $this->_carrierHelper->convertMeasureWeight(
sprintf('%.3f', $weight),
(float)$weight,
$configWeightUnit,
$countryWeightUnit
);
Expand Down Expand Up @@ -908,7 +908,7 @@ protected function _getDimension($dimension, $configWeightUnit = false)

if ($configDimensionUnit != $countryDimensionUnit) {
$dimension = $this->_carrierHelper->convertMeasureDimension(
sprintf('%.3f', $dimension),
(float)$dimension,
$configDimensionUnit,
$countryDimensionUnit
);
Expand All @@ -928,9 +928,9 @@ protected function _addDimension($nodePiece)
{
$sizeChecker = (string)$this->getConfigData('size');

$height = $this->_getDimension((string)$this->getConfigData('height'));
$depth = $this->_getDimension((string)$this->getConfigData('depth'));
$width = $this->_getDimension((string)$this->getConfigData('width'));
$height = $this->_getDimension((float)$this->getConfigData('height'));
$depth = $this->_getDimension((float)$this->getConfigData('depth'));
$width = $this->_getDimension((float)$this->getConfigData('width'));

if ($sizeChecker && $height && $depth && $width) {
$nodePiece->addChild('Height', $height);
Expand Down
21 changes: 19 additions & 2 deletions app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ function ($data) {

$this->errorFactory->expects($this->any())->method('create')->willReturn($this->error);

$localeResolver = $this->getMockForAbstractClass(\Magento\Framework\Locale\ResolverInterface::class);
$localeResolver->method('getLocale')->willReturn('fr_FR');

$carrierHelper = $this->objectManager->getObject(
\Magento\Shipping\Helper\Carrier::class,
[
'localeResolver' => $localeResolver
]
);
$this->model = $this->objectManager->getObject(
\Magento\Dhl\Model\Carrier::class,
[
Expand All @@ -179,6 +188,7 @@ function ($data) {
'httpClientFactory' => $httpClientFactory,
'readFactory' => $readFactory,
'storeManager' => $storeManager,
'carrierHelper' => $carrierHelper,
'data' => ['id' => 'dhl', 'store' => '1']
]
);
Expand All @@ -205,7 +215,11 @@ public function scopeConfigGetValue($path)
'carriers/dhl/showmethod' => 1,
'carriers/dhl/title' => 'dhl Title',
'carriers/dhl/specificerrmsg' => 'dhl error message',
'carriers/dhl/unit_of_measure' => 'L',
'carriers/dhl/unit_of_measure' => 'K',
'carriers/dhl/size' => '1',
'carriers/dhl/height' => '1.6',
'carriers/dhl/width' => '1.6',
'carriers/dhl/depth' => '1.6',
];
return isset($pathMap[$path]) ? $pathMap[$path] : null;
}
Expand Down Expand Up @@ -280,7 +294,10 @@ public function testCollectRates()
$rawPostData->setAccessible(true);

self::assertNotEmpty($this->model->collectRates($request)->getAllRates());
self::assertContains('<Weight>8.266</Weight>', $rawPostData->getValue($this->httpClient));
self::assertContains('<Weight>18.223</Weight>', $rawPostData->getValue($this->httpClient));
self::assertContains('<Height>0.630</Height>', $rawPostData->getValue($this->httpClient));
self::assertContains('<Width>0.630</Width>', $rawPostData->getValue($this->httpClient));
self::assertContains('<Depth>0.630</Depth>', $rawPostData->getValue($this->httpClient));
}

public function testCollectRatesErrorMessage()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public function getCartItemProcessors()
return $this->cartItemProcessors;
}

$arguments = $this->objectManagerConfig->getArguments(\Magento\Quote\Model\Quote\Item\Repository::class);
$typePreference = $this->objectManagerConfig->getPreference(Repository::class);
$arguments = $this->objectManagerConfig->getArguments($typePreference);
if (isset($arguments['cartItemProcessors'])) {
// Workaround for compiled mode.
$processors = isset($arguments['cartItemProcessors']['_vac_'])
Expand Down
57 changes: 7 additions & 50 deletions app/code/Magento/SalesSequence/Setup/InstallData.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,79 +3,36 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\SalesSequence\Setup;

use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\SalesSequence\Model\Builder;
use Magento\SalesSequence\Model\Config as SequenceConfig;
use Magento\SalesSequence\Model\EntityPool;

/**
* Class InstallData
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @codeCoverageIgnore
* @since 2.0.0
* Recurring data upgrade for SalesSequence module.
*/
class InstallData implements InstallDataInterface
{
/**
* Sales setup factory
*
* @var EntityPool
* @since 2.0.0
*/
private $entityPool;

/**
* @var Builder
* @since 2.0.0
*/
private $sequenceBuilder;

/**
* @var SequenceConfig
* @since 2.0.0
* @var SequenceCreator
*/
private $sequenceConfig;
private $sequenceCreator;

/**
* @param EntityPool $entityPool
* @param Builder $sequenceBuilder
* @param SequenceConfig $sequenceConfig
* @since 2.0.0
* @param SequenceCreator $sequenceCreator
*/
public function __construct(
EntityPool $entityPool,
Builder $sequenceBuilder,
SequenceConfig $sequenceConfig
SequenceCreator $sequenceCreator
) {
$this->entityPool = $entityPool;
$this->sequenceBuilder = $sequenceBuilder;
$this->sequenceConfig = $sequenceConfig;
$this->sequenceCreator = $sequenceCreator;
}

/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @since 2.0.0
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$defaultStoreIds = [0, 1];
foreach ($defaultStoreIds as $storeId) {
foreach ($this->entityPool->getEntities() as $entityType) {
$this->sequenceBuilder->setPrefix($this->sequenceConfig->get('prefix'))
->setSuffix($this->sequenceConfig->get('suffix'))
->setStartValue($this->sequenceConfig->get('startValue'))
->setStoreId($storeId)
->setStep($this->sequenceConfig->get('step'))
->setWarningValue($this->sequenceConfig->get('warningValue'))
->setMaxValue($this->sequenceConfig->get('maxValue'))
->setEntityType($entityType)->create();
}
}
$this->sequenceCreator->create();
}
}
38 changes: 38 additions & 0 deletions app/code/Magento/SalesSequence/Setup/RecurringData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\SalesSequence\Setup;

use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

/**
* Recurring data upgrade for SalesSequence module.
*/
class RecurringData implements InstallDataInterface
{
/**
* @var SequenceCreator
*/
private $sequenceCreator;

/**
* @param SequenceCreator $sequenceCreator
*/
public function __construct(
SequenceCreator $sequenceCreator
) {
$this->sequenceCreator = $sequenceCreator;
}

/**
* {@inheritdoc}
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$this->sequenceCreator->create();
}
}
69 changes: 69 additions & 0 deletions app/code/Magento/SalesSequence/Setup/SequenceCreator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\SalesSequence\Setup;

use Magento\SalesSequence\Model\Builder;
use Magento\SalesSequence\Model\Config as SequenceConfig;
use Magento\SalesSequence\Model\EntityPool;

/**
* Initial creating sequences.
*/
class SequenceCreator
{
/**
* Sales setup factory
*
* @var EntityPool
*/
private $entityPool;

/**
* @var Builder
*/
private $sequenceBuilder;

/**
* @var SequenceConfig
*/
private $sequenceConfig;

/**
* @param EntityPool $entityPool
* @param Builder $sequenceBuilder
* @param SequenceConfig $sequenceConfig
*/
public function __construct(
EntityPool $entityPool,
Builder $sequenceBuilder,
SequenceConfig $sequenceConfig
) {
$this->entityPool = $entityPool;
$this->sequenceBuilder = $sequenceBuilder;
$this->sequenceConfig = $sequenceConfig;
}

/**
* Creates sales sequences.
*/
public function create()
{
$defaultStoreIds = [0, 1];
foreach ($defaultStoreIds as $storeId) {
foreach ($this->entityPool->getEntities() as $entityType) {
$this->sequenceBuilder->setPrefix($this->sequenceConfig->get('prefix'))
->setSuffix($this->sequenceConfig->get('suffix'))
->setStartValue($this->sequenceConfig->get('startValue'))
->setStoreId($storeId)
->setStep($this->sequenceConfig->get('step'))
->setWarningValue($this->sequenceConfig->get('warningValue'))
->setMaxValue($this->sequenceConfig->get('maxValue'))
->setEntityType($entityType)->create();
}
}
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/UrlRewrite/Controller/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class Router implements \Magento\Framework\App\RouterInterface
{
/**
* @var
* @var \Magento\Framework\App\ActionFactory
* @since 2.0.0
*/
protected $actionFactory;
Expand Down
Loading

0 comments on commit 9badb94

Please sign in to comment.