Skip to content

Commit

Permalink
Merge pull request #3898 from magento-arcticfoxes/2.3-develop-pr
Browse files Browse the repository at this point in the history
[2.3-develop] Sync with 2.3.1-release
  • Loading branch information
joanhe authored Mar 15, 2019
2 parents f3d7a0d + f3b92fb commit ce17220
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,6 @@ protected function modifyPriceData($object, $data)
/** @var \Magento\Catalog\Model\Product $object */
$data = parent::modifyPriceData($object, $data);
$price = $object->getPrice();

$specialPrice = $object->getSpecialPrice();
$specialPriceFromDate = $object->getSpecialFromDate();
$specialPriceToDate = $object->getSpecialToDate();
$today = time();

if ($specialPrice && ($object->getPrice() > $object->getFinalPrice())) {
if ($today >= strtotime($specialPriceFromDate) && $today <= strtotime($specialPriceToDate) ||
$today >= strtotime($specialPriceFromDate) && $specialPriceToDate === null) {
$price = $specialPrice;
}
}

foreach ($data as $key => $tierPrice) {
$percentageValue = $this->getPercentage($tierPrice);
if ($percentageValue) {
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/CatalogAnalytics/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"require": {
"php": "~7.1.3||~7.2.0",
"magento/framework": "*",
"magento/module-catalog": "*"
"magento/module-catalog": "*",
"magento/module-analytics": "*"
},
"type": "magento2-module",
"license": [
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/CustomerAnalytics/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"require": {
"php": "~7.1.3||~7.2.0",
"magento/framework": "*",
"magento/module-customer": "*"
"magento/module-customer": "*",
"magento/module-analytics": "*"
},
"type": "magento2-module",
"license": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

use Magento\Checkout\Model\ConfigProviderInterface;

/**
* Class CompositeConfigProvider
*/
class CompositeConfigProvider implements ConfigProviderInterface
{
/**
Expand All @@ -18,13 +21,13 @@ class CompositeConfigProvider implements ConfigProviderInterface
* @param ConfigProviderInterface[] $configProviders
*/
public function __construct(
array $configProviders
array $configProviders = []
) {
$this->configProviders = $configProviders;
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getConfig()
{
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/QuoteAnalytics/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"require": {
"php": "~7.1.3||~7.2.0",
"magento/framework": "*",
"magento/module-quote": "*"
"magento/module-quote": "*",
"magento/module-analytics": "*"
},
"type": "magento2-module",
"license": [
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/ReviewAnalytics/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"require": {
"php": "~7.1.3||~7.2.0",
"magento/framework": "*",
"magento/module-review": "*"
"magento/module-review": "*",
"magento/module-analytics": "*"
},
"type": "magento2-module",
"license": [
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/SalesAnalytics/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"require": {
"php": "~7.1.3||~7.2.0",
"magento/framework": "*",
"magento/module-sales": "*"
"magento/module-sales": "*",
"magento/module-analytics": "*"
},
"type": "magento2-module",
"license": [
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/WishlistAnalytics/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"require": {
"php": "~7.1.3||~7.2.0",
"magento/framework": "*",
"magento/module-wishlist": "*"
"magento/module-wishlist": "*",
"magento/module-analytics": "*"
},
"type": "magento2-module",
"license": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\TestFramework\Dependency;

/**
* Class provides dependency rule for analytics.xml config file.
*/
class AnalyticsConfigRule implements RuleInterface
{
/**
* @inheritdoc
*/
public function getDependencyInfo($currentModule, $fileType, $file, &$contents)
{
if ('config' != $fileType || !preg_match('#.*/analytics\.xml$#', $file)) {
return [];
}

$dependenciesInfo = [];
if (preg_match_all('#<[customProvider|reportProvider][^>]*class=[\'"]([^\'"]+)[\'"]#i', $contents, $matches)) {
$classes = array_pop($matches);
foreach ($classes as $class) {
$classParts = explode('\\', $class);
$module = implode('\\', array_slice($classParts, 0, 2));
if (strtolower($currentModule) !== strtolower($module)) {
$dependenciesInfo[] = [
'module' => $module,
'type' => RuleInterface::TYPE_HARD,
'source' => $file,
];
}
}
}

return $dependenciesInfo;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Magento\TestFramework\Dependency\LayoutRule;
use Magento\TestFramework\Dependency\PhpRule;
use Magento\TestFramework\Dependency\ReportsConfigRule;
use Magento\TestFramework\Dependency\AnalyticsConfigRule;
use Magento\TestFramework\Dependency\VirtualType\VirtualTypeMapper;

/**
Expand Down Expand Up @@ -78,6 +79,17 @@ class DependencyTest extends \PHPUnit\Framework\TestCase
*/
protected static $_listRoutesXml = [];

/**
* List of analytics.xml
*
* Format: array(
* '{Module_Name}' => '{Filename}'
* )
*
* @var array
*/
protected static $_listAnalyticsXml = [];

/**
* List of routers
*
Expand Down Expand Up @@ -176,6 +188,7 @@ public static function setUpBeforeClass()
self::_prepareListConfigXml();
self::_prepareListDbSchemaXml();
self::_prepareListRoutesXml();
self::_prepareListAnalyticsXml();

self::_prepareMapRouters();
self::_prepareMapLayoutBlocks();
Expand Down Expand Up @@ -240,6 +253,7 @@ protected static function _initRules()
),
new DiRule(new VirtualTypeMapper()),
new ReportsConfigRule($dbRuleTables),
new AnalyticsConfigRule(),
];
}

Expand Down Expand Up @@ -571,6 +585,20 @@ protected static function _prepareListRoutesXml()
}
}

/**
* Prepare list of analytics.xml files
*/
protected static function _prepareListAnalyticsXml()
{
$files = Files::init()->getDbSchemaFiles('analytics.xml', [], false);
foreach ($files as $file) {
if (preg_match('/(?<namespace>[A-Z][a-z]+)[_\/\\\\](?<module>[A-Z][a-zA-Z]+)/', $file, $matches)) {
$module = $matches['namespace'] . '\\' . $matches['module'];
self::$_listAnalyticsXml[$module] = $file;
}
}
}

/**
* Prepare map of routers
*/
Expand Down

0 comments on commit ce17220

Please sign in to comment.