-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.4-develop' into PWA-1326
- Loading branch information
Showing
8 changed files
with
297 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...Elasticsearch7/Test/Mftf/Test/StorefrontQuickSearchUsingElasticSearchByProductSkuTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?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="StorefrontQuickSearchUsingElasticSearchByProductSkuTest"> | ||
<annotations> | ||
<features value="Elasticsearch7"/> | ||
<stories value="Storefront Search"/> | ||
<title value="Check that AND query is performed when searching using ElasticSearch 7"/> | ||
<description value="Check that AND query is performed when searching using ElasticSearch 7"/> | ||
<severity value="CRITICAL"/> | ||
<testCaseId value="MC-31114"/> | ||
<useCaseId value="MC-29788"/> | ||
<group value="SearchEngineElasticsearch"/> | ||
</annotations> | ||
<before> | ||
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> | ||
<actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/> | ||
|
||
<createData entity="VirtualProduct" stepKey="createFirtsSimpleProduct"/> | ||
<createData entity="SimpleProductWithCustomSku24MB06" stepKey="createSecondSimpleProduct"/> | ||
<createData entity="SimpleProductWithCustomSku24MB04" stepKey="createThirdSimpleProduct"/> | ||
<createData entity="SimpleProductWithCustomSku24MB02" stepKey="createFourthSimpleProduct"/> | ||
<createData entity="SimpleProductWithCustomSku24MB01" stepKey="createFifthSimpleProduct"/> | ||
|
||
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache"> | ||
<argument name="tags" value=""/> | ||
</actionGroup> | ||
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> | ||
<argument name="indices" value=""/> | ||
</actionGroup> | ||
</before> | ||
<after> | ||
<deleteData createDataKey="createFirtsSimpleProduct" stepKey="deleteProductOne"/> | ||
|
||
<actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProductsAfterTest"/> | ||
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdminPanel"/> | ||
</after> | ||
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStoreFrontHomePage"/> | ||
<actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchByProductSku"> | ||
<argument name="phrase" value="24 MB04"/> | ||
</actionGroup> | ||
|
||
<see userInput="4" selector="{{StorefrontCatalogSearchMainSection.productCount}}" stepKey="assertSearchResultCount"/> | ||
|
||
<actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="assertSecondProductName"> | ||
<argument name="productName" value="$createSecondSimpleProduct.name$"/> | ||
</actionGroup> | ||
<actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="assertThirdProductName"> | ||
<argument name="productName" value="$createThirdSimpleProduct.name$"/> | ||
</actionGroup> | ||
<actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="assertFourthProductName"> | ||
<argument name="productName" value="$createFourthSimpleProduct.name$"/> | ||
</actionGroup> | ||
<actionGroup ref="StorefrontQuickSearchSeeProductByNameActionGroup" stepKey="assertFifthProductName"> | ||
<argument name="productName" value="$createFifthSimpleProduct.name$"/> | ||
</actionGroup> | ||
</test> | ||
</tests> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
.../integration/testsuite/Magento/Customer/_files/attribute_postcode_store_label_address.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
use Magento\Customer\Api\AddressMetadataInterface; | ||
use Magento\Customer\Api\Data\AddressInterface; | ||
use Magento\Eav\Api\AttributeRepositoryInterface; | ||
use Magento\Store\Model\StoreManagerInterface; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
|
||
$objectManager = Bootstrap::getObjectManager(); | ||
/** @var AttributeRepositoryInterface $attributeRepository */ | ||
$attributeRepository = $objectManager->get(AttributeRepositoryInterface::class); | ||
/** @var StoreManagerInterface $storeManager */ | ||
$storeManager = $objectManager->get(StoreManagerInterface::class); | ||
$attribute = $attributeRepository->get(AddressMetadataInterface::ENTITY_TYPE_ADDRESS, AddressInterface::POSTCODE); | ||
$storeLabels = $attribute->getStoreLabels(); | ||
$stores = $storeManager->getStores(); | ||
foreach ($stores as $store) { | ||
$storeLabels[$store->getId()] = $store->getCode() . ' store postcode label'; | ||
} | ||
$attribute->setStoreLabels($storeLabels); | ||
$attributeRepository->save($attribute); |
30 changes: 30 additions & 0 deletions
30
...ion/testsuite/Magento/Customer/_files/attribute_postcode_store_label_address_rollback.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
use Magento\Customer\Api\AddressMetadataInterface; | ||
use Magento\Customer\Api\Data\AddressInterface; | ||
use Magento\Eav\Api\AttributeRepositoryInterface; | ||
use Magento\Framework\Registry; | ||
use Magento\Store\Model\StoreManagerInterface; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
|
||
$objectManager = Bootstrap::getObjectManager(); | ||
$registry = $objectManager->get(Registry::class); | ||
/** @var AttributeRepositoryInterface $attributeRepository */ | ||
$attributeRepository = $objectManager->get(AttributeRepositoryInterface::class); | ||
/** @var StoreManagerInterface $storeManager */ | ||
$storeManager = $objectManager->get(StoreManagerInterface::class); | ||
|
||
$registry->unregister('isSecureArea'); | ||
$registry->register('isSecureArea', true); | ||
|
||
$attribute = $attributeRepository->get(AddressMetadataInterface::ENTITY_TYPE_ADDRESS, AddressInterface::POSTCODE); | ||
$attribute->setStoreLabels([]); | ||
$attributeRepository->save($attribute); | ||
|
||
$registry->unregister('isSecureArea'); | ||
$registry->register('isSecureArea', false); |
104 changes: 104 additions & 0 deletions
104
dev/tests/integration/testsuite/Magento/Eav/Model/Entity/Attribute/Frontend/DatetimeTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Eav\Model\Entity\Attribute\Frontend; | ||
|
||
use Magento\Catalog\Api\ProductAttributeRepositoryInterface; | ||
use Magento\Catalog\Api\ProductRepositoryInterface; | ||
use Magento\Framework\ObjectManagerInterface; | ||
use Magento\Framework\Stdlib\DateTime\DateTime; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
use Magento\TestFramework\Store\ExecuteInStoreContext; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Checks Datetime attribute's frontend model | ||
* | ||
* @magentoAppArea frontend | ||
* | ||
* @see \Magento\Eav\Model\Entity\Attribute\Frontend\Datetime | ||
*/ | ||
class DatetimeTest extends TestCase | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
private const ONE_HOUR_IN_MILLISECONDS = 3600; | ||
|
||
/** | ||
* @var ObjectManagerInterface | ||
*/ | ||
private $objectManager; | ||
|
||
/** | ||
* @var ProductAttributeRepositoryInterface | ||
*/ | ||
private $attributeRepository; | ||
|
||
/** | ||
* @var ProductRepositoryInterface | ||
*/ | ||
private $productRepository; | ||
|
||
/** | ||
* @var DateTime | ||
*/ | ||
private $dateTime; | ||
|
||
/** | ||
* @var ExecuteInStoreContext | ||
*/ | ||
private $executeInStoreContext; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->objectManager = Bootstrap::getObjectManager(); | ||
$this->attributeRepository = $this->objectManager->get(ProductAttributeRepositoryInterface::class); | ||
$this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); | ||
$this->productRepository->cleanCache(); | ||
$this->dateTime = $this->objectManager->create(DateTime::class); | ||
$this->executeInStoreContext = $this->objectManager->get(ExecuteInStoreContext::class); | ||
} | ||
|
||
/** | ||
* @magentoDbIsolation disabled | ||
* | ||
* @magentoDataFixture Magento/Catalog/_files/product_two_websites.php | ||
* @magentoDataFixture Magento/Catalog/_files/product_datetime_attribute.php | ||
* | ||
* @magentoConfigFixture default_store general/locale/timezone Europe/Moscow | ||
* @magentoConfigFixture fixture_second_store_store general/locale/timezone Europe/Kiev | ||
* | ||
* @return void | ||
*/ | ||
public function testFrontendValueOnDifferentWebsites(): void | ||
{ | ||
$attribute = $this->attributeRepository->get('datetime_attribute'); | ||
$product = $this->productRepository->get('simple-on-two-websites'); | ||
$product->setDatetimeAttribute($this->dateTime->date('Y-m-d H:i:s')); | ||
$firstWebsiteValue = $this->executeInStoreContext->execute( | ||
'default', | ||
[$attribute->getFrontend(), 'getValue'], | ||
$product | ||
); | ||
$secondWebsiteValue = $this->executeInStoreContext->execute( | ||
'fixture_second_store', | ||
[$attribute->getFrontend(), 'getValue'], | ||
$product | ||
); | ||
$this->assertEquals( | ||
self::ONE_HOUR_IN_MILLISECONDS, | ||
$this->dateTime->gmtTimestamp($firstWebsiteValue) - $this->dateTime->gmtTimestamp($secondWebsiteValue), | ||
'The difference between values per different timezones is incorrect' | ||
); | ||
} | ||
} |