Skip to content

Commit

Permalink
🔃 [Magento Community Engineering] Community Contributions - 2.4-devel…
Browse files Browse the repository at this point in the history
…op expedited

Accepted Community Pull Requests:
 - #27399: Fixed the wrong behavior for a prompt modal when a user clicks on the modal overlay (by @serhiyzhovnir)
 - #26100: Fixed 24990: link doesn't redirect to dashboard (by @Usik2203)
 - #27493: Fix the minicart items actions alignment for tablet and desktop devices (by @vasilii-b)
 - #27492: Fixed tests for Magento\Framework\Stdlib\DateTime\DateTime (by @andrewbess)
 - #26397: Cleanup ObjectManager usage - Magento_Bundle (by @Bartlomiejsz)


Fixed GitHub Issues:
 - #24990: Admin Panel logo link is not directing to admin dashboard page (reported by @Nagamaiah007) has been fixed in #26100 by @Usik2203 in 2.4-develop branch
   Related commits:
     1. 5a5091c
     2. 1818eaf
     3. c98e03f
     4. 8c672eb
     5. b90f20c
     6. 531a22f
     7. 4336cf1
     8. f39a494
     9. 31bbf07
     10. e1b0ff0
  • Loading branch information
magento-engcom-team authored Apr 2, 2020
2 parents a1aaf8f + e38eebe commit def8a07
Show file tree
Hide file tree
Showing 33 changed files with 1,479 additions and 1,143 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminClickLogoActionGroup">
<click selector="{{AdminMenuSection.logo}}" stepKey="clickLogoInAdmin"/>
<waitForPageLoad stepKey="waitForAdminDashboardPageLoaded"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminNavigateToSetupWizardPageActionGroup">
<annotations>
<description>Open Setup Wizard Page.</description>
</annotations>
<amOnPage url="{{AdminSetupWizardPage.url}}" stepKey="navigateToSetupWizardPage"/>
<waitForPageLoad stepKey="waitForSetupWizardPageLoaded"/>
</actionGroup>
</actionGroups>
12 changes: 12 additions & 0 deletions app/code/Magento/Backend/Test/Mftf/Page/AdminSetupWizardPage.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="AdminSetupWizardPage" url="admin/backendapp/redirect/app/setup/" area="admin" module="Magento_Backend"/>
</pages>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminMenuSection">
<element name="logo" type="button" selector=".menu-wrapper a.logo"/>
<element name="catalog" type="button" selector="#menu-magento-catalog-catalog"/>
<element name="catalogProducts" type="button" selector="#nav li[data-ui-id='menu-magento-catalog-catalog-products']"/>
<element name="customers" type="button" selector="#menu-magento-customer-customer"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminRedirectToAdminPanelOnLogoClickFromWizardPageTest">
<annotations>
<features value="Backend"/>
<stories value="Navigate to dashboard from Setup Wizard Page"/>
<title value="Navigate to dashboard after click on logo on Setup Wizard Page"/>
<description value="Check navigate to dashboard after click on logo on Setup Wizard Page"/>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/>
</before>
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
</after>

<actionGroup ref="AdminNavigateToSetupWizardPageActionGroup" stepKey="navigateToSetupWizardPage"/>
<actionGroup ref="AdminClickLogoActionGroup" stepKey="clickOnLogo"/>
<actionGroup ref="AssertAdminDashboardPageIsVisibleActionGroup" stepKey="checkTheDashboardPage"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
use Braintree\Result\Successful;
use Braintree\Transaction;
use Braintree\Transaction\PayPalDetails;
use Magento\Braintree\Gateway\SubjectReader;
use Magento\Braintree\Gateway\Response\PayPal\VaultDetailsHandler;
use Magento\Braintree\Gateway\SubjectReader;
use Magento\Framework\Intl\DateTimeFactory;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\Payment\Gateway\Data\PaymentDataObjectInterface;
Expand Down Expand Up @@ -99,7 +99,12 @@ protected function setUp()
->getMock();

$this->paymentExtensionMock = $this->getMockBuilder(OrderPaymentExtensionInterface::class)
->setMethods(['setVaultPaymentToken', 'getVaultPaymentToken'])
->setMethods([
'setVaultPaymentToken',
'getVaultPaymentToken',
'setNotificationMessage',
'getNotificationMessage'
])
->disableOriginalConstructor()
->getMock();
$this->paymentExtensionFactoryMock = $this->getMockBuilder(OrderPaymentExtensionInterfaceFactory::class)
Expand All @@ -119,7 +124,7 @@ protected function setUp()
->disableOriginalConstructor()
->setMethods(['create'])
->getMock();

$this->handler = new VaultDetailsHandler(
$this->paymentTokenFactoryMock,
$this->paymentExtensionFactoryMock,
Expand All @@ -139,7 +144,7 @@ public function testHandle()
->with($this->paymentTokenMock);
$this->paymentExtensionMock->method('getVaultPaymentToken')
->willReturn($this->paymentTokenMock);

$this->paymentDataObjectMock->method('getPayment')
->willReturn($this->paymentInfoMock);

Expand All @@ -154,7 +159,7 @@ public function testHandle()
$expirationDate = '2017-07-05 00:00:00';
$this->dateTimeFactoryMock->method('create')
->willReturn($dateTime);

$this->handler->handle($this->subject, $response);

$extensionAttributes = $this->paymentInfoMock->getExtensionAttributes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use PHPUnit_Framework_MockObject_MockObject as MockObject;

/**
* VaultDetailsHandler Test
* Verify class VaultDetailsHandler
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
Expand Down Expand Up @@ -216,7 +216,12 @@ private function getConfigMock(): Config
private function initPaymentExtensionAttributesMock()
{
$this->paymentExtension = $this->getMockBuilder(OrderPaymentExtensionInterface::class)
->setMethods(['setVaultPaymentToken', 'getVaultPaymentToken'])
->setMethods([
'setVaultPaymentToken',
'getVaultPaymentToken',
'setNotificationMessage',
'getNotificationMessage'
])
->disableOriginalConstructor()
->getMock();

Expand Down
85 changes: 39 additions & 46 deletions app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,30 @@
namespace Magento\Bundle\Block\Catalog\Product\View\Type;

use Magento\Bundle\Model\Option;
use Magento\Bundle\Model\Product\Price;
use Magento\Bundle\Model\Product\PriceFactory;
use Magento\Bundle\Model\Product\Type;
use Magento\Catalog\Block\Product\Context;
use Magento\Catalog\Block\Product\View\AbstractView;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Pricing\Price\FinalPrice;
use Magento\Catalog\Pricing\Price\RegularPrice;
use Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\DataObject;
use Magento\Framework\Json\EncoderInterface;
use Magento\Framework\Locale\FormatInterface;
use Magento\Framework\Stdlib\ArrayUtils;

/**
* Catalog bundle product info block
*
* @api
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @api
* @since 100.0.2
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView
class Bundle extends AbstractView
{

/**
* @var array
*/
Expand All @@ -33,17 +43,17 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView
protected $catalogProduct;

/**
* @var \Magento\Bundle\Model\Product\PriceFactory
* @var PriceFactory
*/
protected $productPriceFactory;

/**
* @var \Magento\Framework\Json\EncoderInterface
* @var EncoderInterface
*/
protected $jsonEncoder;

/**
* @var \Magento\Framework\Locale\FormatInterface
* @var FormatInterface
*/
protected $localeFormat;

Expand All @@ -63,22 +73,24 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView
private $optionsPosition = [];

/**
* @param \Magento\Catalog\Block\Product\Context $context
* @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils
* @param Context $context
* @param ArrayUtils $arrayUtils
* @param \Magento\Catalog\Helper\Product $catalogProduct
* @param \Magento\Bundle\Model\Product\PriceFactory $productPrice
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
* @param \Magento\Framework\Locale\FormatInterface $localeFormat
* @param PriceFactory $productPrice
* @param EncoderInterface $jsonEncoder
* @param FormatInterface $localeFormat
* @param array $data
* @param CollectionProcessor|null $catalogRuleProcessor
*/
public function __construct(
\Magento\Catalog\Block\Product\Context $context,
\Magento\Framework\Stdlib\ArrayUtils $arrayUtils,
Context $context,
ArrayUtils $arrayUtils,
\Magento\Catalog\Helper\Product $catalogProduct,
\Magento\Bundle\Model\Product\PriceFactory $productPrice,
\Magento\Framework\Json\EncoderInterface $jsonEncoder,
\Magento\Framework\Locale\FormatInterface $localeFormat,
array $data = []
PriceFactory $productPrice,
EncoderInterface $jsonEncoder,
FormatInterface $localeFormat,
array $data = [],
?CollectionProcessor $catalogRuleProcessor = null
) {
$this->catalogProduct = $catalogProduct;
$this->productPriceFactory = $productPrice;
Expand All @@ -89,22 +101,8 @@ public function __construct(
$arrayUtils,
$data
);
}

/**
* Return catalog rule processor or creates processor if it does not exist
*
* @deprecated 100.2.0
* @return \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor
*/
private function getCatalogRuleProcessor()
{
if ($this->catalogRuleProcessor === null) {
$this->catalogRuleProcessor = \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor::class);
}

return $this->catalogRuleProcessor;
$this->catalogRuleProcessor = $catalogRuleProcessor ?? ObjectManager::getInstance()
->get(CollectionProcessor::class);
}

/**
Expand All @@ -120,7 +118,7 @@ public function getOptions($stripSelection = false)
{
if (!$this->options) {
$product = $this->getProduct();
/** @var \Magento\Bundle\Model\Product\Type $typeInstance */
/** @var Type $typeInstance */
$typeInstance = $product->getTypeInstance();
$typeInstance->setStoreFilter($product->getStoreId(), $product);

Expand All @@ -130,7 +128,7 @@ public function getOptions($stripSelection = false)
$typeInstance->getOptionsIds($product),
$product
);
$this->getCatalogRuleProcessor()->addPriceData($selectionCollection);
$this->catalogRuleProcessor->addPriceData($selectionCollection);
$selectionCollection->addTierPriceData();

$this->options = $optionCollection->appendSelections(
Expand All @@ -151,10 +149,7 @@ public function getOptions($stripSelection = false)
public function hasOptions()
{
$this->getOptions();
if (empty($this->options) || !$this->getProduct()->isSalable()) {
return false;
}
return true;
return !(empty($this->options) || !$this->getProduct()->isSalable());
}

/**
Expand Down Expand Up @@ -255,7 +250,7 @@ private function getSelectionItemData(Product $product, Product $selection)
->getOptionSelectionAmount($selection)
->getValue();

$selection = [
return [
'qty' => $qty,
'customQty' => $selection->getSelectionCanChangeQty(),
'optionId' => $selection->getId(),
Expand All @@ -275,8 +270,6 @@ private function getSelectionItemData(Product $product, Product $selection)
'name' => $selection->getName(),
'canApplyMsrp' => false,
];

return $selection;
}

/**
Expand Down Expand Up @@ -371,16 +364,16 @@ private function getOptionItemData(Option $option, Product $product, $position)
*/
private function getConfigData(Product $product, array $options)
{
$isFixedPrice = $this->getProduct()->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED;
$isFixedPrice = $this->getProduct()->getPriceType() == Price::PRICE_TYPE_FIXED;

$productAmount = $product
->getPriceInfo()
->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)
->getPrice(FinalPrice::PRICE_CODE)
->getPriceWithoutOption();

$baseProductAmount = $product
->getPriceInfo()
->getPrice(\Magento\Catalog\Pricing\Price\RegularPrice::PRICE_CODE)
->getPrice(RegularPrice::PRICE_CODE)
->getAmount();

$config = [
Expand Down
Loading

0 comments on commit def8a07

Please sign in to comment.