Skip to content

Commit 08096a7

Browse files
merge magento-commerce/2.4-develop into magento-tsg/2.4-develop-pr134
2 parents ced9ab5 + 3a814d9 commit 08096a7

File tree

8 files changed

+297
-4
lines changed

8 files changed

+297
-4
lines changed

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSearchBundleProductsByKeywordsTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
</createData>
4242

4343
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
44-
<argument name="indices" value="cataloginventory_stock catalog_product_price"/>
44+
<argument name="indices" value=""/>
4545
</actionGroup>
4646
</before>
4747
<after>

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,9 +1392,34 @@
13921392
<entity name="SimpleProductUpdatePrice16" type="product2">
13931393
<data key="price">16.00</data>
13941394
</entity>
1395+
<entity name="SimpleProductUpdatePrice90" type="product2">
1396+
<data key="price">90.00</data>
1397+
</entity>
1398+
<entity name="SimpleProductUpdatePrice95" type="product2">
1399+
<data key="price">95.00</data>
1400+
</entity>
1401+
<entity name="SimpleProductUpdatePrice80" type="product2">
1402+
<data key="price">80.00</data>
1403+
</entity>
13951404
<entity name="ProductWithTwoTextFieldOptions" type="product">
13961405
<var key="sku" entityType="product" entityKey="sku" />
13971406
<requiredEntity type="product_option">ProductOptionField</requiredEntity>
13981407
<requiredEntity type="product_option">ProductOptionField2</requiredEntity>
13991408
</entity>
1409+
<entity name="SimpleProductWithCustomSku24MB01" type="product" extends="SimpleProduct2">
1410+
<data key="name" unique="suffix">ProductWithSku24MB01-</data>
1411+
<data key="sku" unique="suffix">24 MB01</data>
1412+
</entity>
1413+
<entity name="SimpleProductWithCustomSku24MB02" type="product" extends="SimpleProduct2">
1414+
<data key="name" unique="suffix">ProductWithSku24MB02-</data>
1415+
<data key="sku" unique="suffix">24 MB02 </data>
1416+
</entity>
1417+
<entity name="SimpleProductWithCustomSku24MB04" type="product" extends="SimpleProduct2">
1418+
<data key="name" unique="suffix">ProductWithSku24MB04-</data>
1419+
<data key="sku" unique="suffix">24 MB04 </data>
1420+
</entity>
1421+
<entity name="SimpleProductWithCustomSku24MB06" type="product" extends="SimpleProduct2">
1422+
<data key="name" unique="suffix">ProductWithSku24MB06-</data>
1423+
<data key="sku" unique="suffix">24 MB06 </data>
1424+
</entity>
14001425
</entities>

app/code/Magento/Config/Test/Mftf/Test/CheckingCountryDropDownWithOneAllowedCountryTest.xml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,25 @@
1111
<test name="CheckingCountryDropDownWithOneAllowedCountryTest">
1212
<annotations>
1313
<features value="Config"/>
14-
<stories value="MAGETWO-96107: Additional blank option in country dropdown"/>
14+
<stories value="Additional blank option in country dropdown"/>
1515
<title value="Checking country drop-down with one allowed country"/>
1616
<description value="Check country drop-down with one allowed country"/>
1717
<severity value="MAJOR"/>
18-
<testCaseId value="MAGETWO-96133"/>
18+
<testCaseId value="MAGETWO-28511"/>
1919
<group value="configuration"/>
2020
</annotations>
2121
<before>
2222
<createData entity="EnableAdminAccountAllowCountry" stepKey="setAllowedCountries"/>
23+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
24+
<argument name="tags" value="config full_page"/>
25+
</actionGroup>
2326
</before>
2427
<after>
2528
<comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCache"/>
2629
<createData entity="DisableAdminAccountAllowCountry" stepKey="setDefaultValueForAllowCountries"/>
30+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
31+
<argument name="tags" value="config full_page"/>
32+
</actionGroup>
2733
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
2834
<actionGroup ref="AdminDeleteCustomerActionGroup" stepKey="deleteCustomer">
2935
<argument name="customerEmail" value="CustomerEntityOne.email"/>
@@ -47,5 +53,12 @@
4753
<click selector="{{StorefrontCustomerAddressSection.country}}" stepKey="clickToExpandCountryDropDown"/>
4854
<see selector="{{StorefrontCustomerAddressSection.country}}" userInput="United States" stepKey="seeSelectedCountry"/>
4955
<dontSee selector="{{StorefrontCustomerAddressSection.country}}" userInput="Brazil" stepKey="canNotSeeSelectedCountry"/>
56+
<createData entity="DisableAdminAccountAllowCountry" stepKey="setDefaultValueForAllowCountries"/>
57+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
58+
<argument name="tags" value="config full_page"/>
59+
</actionGroup>
60+
<reloadPage stepKey="realoadPageAfterConfigChanged"/>
61+
<see selector="{{StorefrontCustomerAddressSection.country}}" userInput="United States" stepKey="seeUnitedStatesCountry"/>
62+
<see selector="{{StorefrontCustomerAddressSection.country}}" userInput="Brazil" stepKey="seeBrazilCountry"/>
5063
</test>
5164
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontQuickSearchUsingElasticSearchByProductSkuTest">
12+
<annotations>
13+
<features value="Elasticsearch7"/>
14+
<stories value="Storefront Search"/>
15+
<title value="Check that AND query is performed when searching using ElasticSearch 7"/>
16+
<description value="Check that AND query is performed when searching using ElasticSearch 7"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-31114"/>
19+
<useCaseId value="MC-29788"/>
20+
<group value="SearchEngineElasticsearch"/>
21+
</annotations>
22+
<before>
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
<actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/>
25+
26+
<createData entity="VirtualProduct" stepKey="createFirtsSimpleProduct"/>
27+
<createData entity="SimpleProductWithCustomSku24MB06" stepKey="createSecondSimpleProduct"/>
28+
<createData entity="SimpleProductWithCustomSku24MB04" stepKey="createThirdSimpleProduct"/>
29+
<createData entity="SimpleProductWithCustomSku24MB02" stepKey="createFourthSimpleProduct"/>
30+
<createData entity="SimpleProductWithCustomSku24MB01" stepKey="createFifthSimpleProduct"/>
31+
32+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
33+
<argument name="tags" value=""/>
34+
</actionGroup>
35+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
36+
<argument name="indices" value=""/>
37+
</actionGroup>
38+
</before>
39+
<after>
40+
<deleteData createDataKey="createFirtsSimpleProduct" stepKey="deleteProductOne"/>
41+
42+
<actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProductsAfterTest"/>
43+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdminPanel"/>
44+
</after>
45+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStoreFrontHomePage"/>
46+
<actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchByProductSku">
47+
<argument name="phrase" value="24 MB04"/>
48+
</actionGroup>
49+
50+
<see userInput="4" selector="{{StorefrontCatalogSearchMainSection.productCount}}" stepKey="assertSearchResultCount"/>
51+
52+
<actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="assertSecondProductName">
53+
<argument name="productName" value="$createSecondSimpleProduct.name$"/>
54+
</actionGroup>
55+
<actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="assertThirdProductName">
56+
<argument name="productName" value="$createThirdSimpleProduct.name$"/>
57+
</actionGroup>
58+
<actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="assertFourthProductName">
59+
<argument name="productName" value="$createFourthSimpleProduct.name$"/>
60+
</actionGroup>
61+
<actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="assertFifthProductName">
62+
<argument name="productName" value="$createFifthSimpleProduct.name$"/>
63+
</actionGroup>
64+
</test>
65+
</tests>

dev/tests/integration/testsuite/Magento/Customer/Block/Address/EditTest.php

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@
1616
use Magento\Framework\View\Result\PageFactory;
1717
use Magento\TestFramework\Helper\Bootstrap;
1818
use Magento\TestFramework\Helper\Xpath;
19+
use Magento\TestFramework\Store\ExecuteInStoreContext;
1920
use PHPUnit\Framework\TestCase;
2021

2122
/**
2223
* Tests Address Edit Block
2324
*
25+
* @see \Magento\Customer\Block\Address\Edit
26+
*
2427
* @magentoAppArea frontend
2528
* @magentoAppIsolation enabled
29+
*
30+
* @magentoDataFixture Magento/Customer/_files/customer.php
2631
*/
2732
class EditTest extends TestCase
2833
{
@@ -41,9 +46,12 @@ class EditTest extends TestCase
4146
/** @var CustomerRegistry */
4247
private $customerRegistry;
4348

44-
/** @var RequestInterface */
49+
/** @var RequestInterface */
4550
private $request;
4651

52+
/** @var ExecuteInStoreContext */
53+
private $executeInStoreContext;
54+
4755
/**
4856
* @inheritdoc
4957
*/
@@ -62,6 +70,7 @@ protected function setUp(): void
6270
$this->block = $page->getLayout()->getBlock('customer_address_edit');
6371
$this->addressRegistry = $this->objectManager->get(AddressRegistry::class);
6472
$this->customerRegistry = $this->objectManager->get(CustomerRegistry::class);
73+
$this->executeInStoreContext = $this->objectManager->get(ExecuteInStoreContext::class);
6574
}
6675

6776
/**
@@ -174,4 +183,25 @@ public function testVatIdFieldNotVisible(): void
174183
$inputXpath = "//div[contains(@class, 'taxvat')]//div/input[contains(@id,'vat_id') and @type='text']";
175184
$this->assertEquals(0, Xpath::getElementsCountForXpath($inputXpath, $html));
176185
}
186+
187+
/**
188+
* @magentoDataFixture Magento/Customer/_files/customer.php
189+
* @magentoDataFixture Magento/Customer/_files/attribute_postcode_store_label_address.php
190+
*
191+
* @return void
192+
*/
193+
public function testCheckPostCodeLabels(): void
194+
{
195+
$html = $this->executeInStoreContext->execute('default', [$this->block, 'toHtml']);
196+
$this->assertEquals(
197+
1,
198+
Xpath::getElementsCountForXpath(
199+
sprintf(
200+
"//form[contains(@class, 'form-address-edit')]//label[@for='zip']/span[contains(text(), '%s')]",
201+
'default store postcode label'
202+
),
203+
$html
204+
)
205+
);
206+
}
177207
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
use Magento\Customer\Api\AddressMetadataInterface;
9+
use Magento\Customer\Api\Data\AddressInterface;
10+
use Magento\Eav\Api\AttributeRepositoryInterface;
11+
use Magento\Store\Model\StoreManagerInterface;
12+
use Magento\TestFramework\Helper\Bootstrap;
13+
14+
$objectManager = Bootstrap::getObjectManager();
15+
/** @var AttributeRepositoryInterface $attributeRepository */
16+
$attributeRepository = $objectManager->get(AttributeRepositoryInterface::class);
17+
/** @var StoreManagerInterface $storeManager */
18+
$storeManager = $objectManager->get(StoreManagerInterface::class);
19+
$attribute = $attributeRepository->get(AddressMetadataInterface::ENTITY_TYPE_ADDRESS, AddressInterface::POSTCODE);
20+
$storeLabels = $attribute->getStoreLabels();
21+
$stores = $storeManager->getStores();
22+
foreach ($stores as $store) {
23+
$storeLabels[$store->getId()] = $store->getCode() . ' store postcode label';
24+
}
25+
$attribute->setStoreLabels($storeLabels);
26+
$attributeRepository->save($attribute);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
use Magento\Customer\Api\AddressMetadataInterface;
9+
use Magento\Customer\Api\Data\AddressInterface;
10+
use Magento\Eav\Api\AttributeRepositoryInterface;
11+
use Magento\Framework\Registry;
12+
use Magento\Store\Model\StoreManagerInterface;
13+
use Magento\TestFramework\Helper\Bootstrap;
14+
15+
$objectManager = Bootstrap::getObjectManager();
16+
$registry = $objectManager->get(Registry::class);
17+
/** @var AttributeRepositoryInterface $attributeRepository */
18+
$attributeRepository = $objectManager->get(AttributeRepositoryInterface::class);
19+
/** @var StoreManagerInterface $storeManager */
20+
$storeManager = $objectManager->get(StoreManagerInterface::class);
21+
22+
$registry->unregister('isSecureArea');
23+
$registry->register('isSecureArea', true);
24+
25+
$attribute = $attributeRepository->get(AddressMetadataInterface::ENTITY_TYPE_ADDRESS, AddressInterface::POSTCODE);
26+
$attribute->setStoreLabels([]);
27+
$attributeRepository->save($attribute);
28+
29+
$registry->unregister('isSecureArea');
30+
$registry->register('isSecureArea', false);
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Eav\Model\Entity\Attribute\Frontend;
9+
10+
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
11+
use Magento\Catalog\Api\ProductRepositoryInterface;
12+
use Magento\Framework\ObjectManagerInterface;
13+
use Magento\Framework\Stdlib\DateTime\DateTime;
14+
use Magento\TestFramework\Helper\Bootstrap;
15+
use Magento\TestFramework\Store\ExecuteInStoreContext;
16+
use PHPUnit\Framework\TestCase;
17+
18+
/**
19+
* Checks Datetime attribute's frontend model
20+
*
21+
* @magentoAppArea frontend
22+
*
23+
* @see \Magento\Eav\Model\Entity\Attribute\Frontend\Datetime
24+
*/
25+
class DatetimeTest extends TestCase
26+
{
27+
/**
28+
* @var int
29+
*/
30+
private const ONE_HOUR_IN_MILLISECONDS = 3600;
31+
32+
/**
33+
* @var ObjectManagerInterface
34+
*/
35+
private $objectManager;
36+
37+
/**
38+
* @var ProductAttributeRepositoryInterface
39+
*/
40+
private $attributeRepository;
41+
42+
/**
43+
* @var ProductRepositoryInterface
44+
*/
45+
private $productRepository;
46+
47+
/**
48+
* @var DateTime
49+
*/
50+
private $dateTime;
51+
52+
/**
53+
* @var ExecuteInStoreContext
54+
*/
55+
private $executeInStoreContext;
56+
57+
/**
58+
* @inheritdoc
59+
*/
60+
protected function setUp(): void
61+
{
62+
parent::setUp();
63+
64+
$this->objectManager = Bootstrap::getObjectManager();
65+
$this->attributeRepository = $this->objectManager->get(ProductAttributeRepositoryInterface::class);
66+
$this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
67+
$this->productRepository->cleanCache();
68+
$this->dateTime = $this->objectManager->create(DateTime::class);
69+
$this->executeInStoreContext = $this->objectManager->get(ExecuteInStoreContext::class);
70+
}
71+
72+
/**
73+
* @magentoDbIsolation disabled
74+
*
75+
* @magentoDataFixture Magento/Catalog/_files/product_two_websites.php
76+
* @magentoDataFixture Magento/Catalog/_files/product_datetime_attribute.php
77+
*
78+
* @magentoConfigFixture default_store general/locale/timezone Europe/Moscow
79+
* @magentoConfigFixture fixture_second_store_store general/locale/timezone Europe/Kiev
80+
*
81+
* @return void
82+
*/
83+
public function testFrontendValueOnDifferentWebsites(): void
84+
{
85+
$attribute = $this->attributeRepository->get('datetime_attribute');
86+
$product = $this->productRepository->get('simple-on-two-websites');
87+
$product->setDatetimeAttribute($this->dateTime->date('Y-m-d H:i:s'));
88+
$firstWebsiteValue = $this->executeInStoreContext->execute(
89+
'default',
90+
[$attribute->getFrontend(), 'getValue'],
91+
$product
92+
);
93+
$secondWebsiteValue = $this->executeInStoreContext->execute(
94+
'fixture_second_store',
95+
[$attribute->getFrontend(), 'getValue'],
96+
$product
97+
);
98+
$this->assertEquals(
99+
self::ONE_HOUR_IN_MILLISECONDS,
100+
$this->dateTime->gmtTimestamp($firstWebsiteValue) - $this->dateTime->gmtTimestamp($secondWebsiteValue),
101+
'The difference between values per different timezones is incorrect'
102+
);
103+
}
104+
}

0 commit comments

Comments
 (0)