Skip to content

Commit 654f273

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-commerce/magento2ce into ACP2E-2300
# Conflicts: # dev/tests/integration/testsuite/Magento/GraphQl/_files/state-skip-list.php
1 parent 5ec7414 commit 654f273

File tree

66 files changed

+4113
-1392
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4113
-1392
lines changed

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,13 @@
114114
"magento/module-admin-analytics": "*",
115115
"magento/module-admin-notification": "*",
116116
"magento/module-advanced-pricing-import-export": "*",
117+
"magento/module-advanced-search": "*",
117118
"magento/module-amqp": "*",
118119
"magento/module-analytics": "*",
120+
"magento/module-application-performance-monitor": "*",
121+
"magento/module-application-performance-monitor-new-relic": "*",
119122
"magento/module-asynchronous-operations": "*",
120123
"magento/module-authorization": "*",
121-
"magento/module-advanced-search": "*",
122124
"magento/module-backend": "*",
123125
"magento/module-backup": "*",
124126
"magento/module-bundle": "*",
@@ -182,6 +184,7 @@
182184
"magento/module-google-gtag": "*",
183185
"magento/module-graph-ql": "*",
184186
"magento/module-graph-ql-cache": "*",
187+
"magento/module-graph-ql-new-relic": "*",
185188
"magento/module-graph-ql-resolver-cache": "*",
186189
"magento/module-catalog-graph-ql": "*",
187190
"magento/module-catalog-cms-graph-ql": "*",

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeIsFilterableManagementTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<?php
22
/************************************************************************
33
*
4-
* ADOBE CONFIDENTIAL
5-
* ___________________
6-
*
7-
* Copyright 2014 Adobe
4+
* Copyright 2023 Adobe
85
* All Rights Reserved.
96
*
107
* NOTICE: All information contained herein is, and remains

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryMultiWebsiteTest.php

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -188,26 +188,17 @@ public function testProductDefaultValuesWithTwoWebsites(): void
188188
/** @var ScopeOverriddenValue $scopeOverriddenValue */
189189
$scopeOverriddenValue = $this->objectManager->get(ScopeOverriddenValue::class);
190190
$storeId = $store->load('fixture_third_store', 'code')->getId();
191-
$this->assertFalse($scopeOverriddenValue->containsValue(
192-
ProductInterface::class,
193-
$product,
194-
'visibility',
195-
$storeId
196-
));
197-
198-
$this->assertFalse($scopeOverriddenValue->containsValue(
199-
ProductInterface::class,
200-
$product,
201-
'tax_class_id',
202-
$storeId
203-
));
204191

205-
$this->assertFalse($scopeOverriddenValue->containsValue(
206-
ProductInterface::class,
207-
$product,
208-
'status',
209-
$storeId
210-
));
192+
$attributeCodeList = ['visibility', 'tax_class_id', 'status', 'short_description', 'description',
193+
'url_key', 'meta_title', 'meta_keywords', 'meta_description'];
194+
foreach ($attributeCodeList as $attributeCode) {
195+
$this->assertFalse($scopeOverriddenValue->containsValue(
196+
ProductInterface::class,
197+
$product,
198+
$attributeCode,
199+
$storeId
200+
));
201+
}
211202
}
212203

213204
/**

dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php

Lines changed: 18 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
*/
2727
class GroupRepositoryTest extends WebapiAbstract
2828
{
29-
const SERVICE_NAME = "customerGroupRepositoryV1";
30-
const SERVICE_VERSION = "V1";
31-
const RESOURCE_PATH = "/V1/customerGroups";
29+
private const SERVICE_NAME = "customerGroupRepositoryV1";
30+
private const SERVICE_VERSION = "V1";
31+
private const RESOURCE_PATH = "/V1/customerGroups";
3232

3333
/**
3434
* @var GroupRegistry
@@ -512,16 +512,27 @@ public function testUpdateGroupWithExcludedWebsiteRest(): void
512512

513513
self::assertEquals($groupId, $this->_webApiCall($serviceInfo, $requestData)[CustomerGroup::ID]);
514514

515-
$group = $this->groupRepository->getById($groupId);
516-
self::assertEquals($groupData[CustomerGroup::CODE], $group->getCode(), 'The group code did not change.');
515+
$serviceInfo = [
516+
'rest' => [
517+
'resourcePath' => self::RESOURCE_PATH . "/$groupId",
518+
'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET,
519+
],
520+
];
521+
522+
$group = $this->_webApiCall($serviceInfo);
523+
self::assertEquals(
524+
$groupData[CustomerGroup::CODE],
525+
$group['code'],
526+
'The group code did not change.'
527+
);
517528
self::assertEquals(
518529
$groupData[CustomerGroup::TAX_CLASS_ID],
519-
$group->getTaxClassId(),
530+
$group['tax_class_id'],
520531
'The group tax class id did not change'
521532
);
522533
self::assertEquals(
523534
['1'],
524-
$group->getExtensionAttributes()->getExcludeWebsiteIds(),
535+
$group['extension_attributes']['exclude_website_ids'],
525536
'The group excluded websites do not match.'
526537
);
527538
}
@@ -850,48 +861,6 @@ public function testUpdateGroupSoap()
850861
);
851862
}
852863

853-
/**
854-
* Verify that updating an existing group with excluded website works via SOAP.
855-
*/
856-
public function testUpdateGroupWithExcludedWebsiteSoap(): void
857-
{
858-
$this->_markTestAsSoapOnly();
859-
$group = $this->customerGroupFactory->create();
860-
$group->setId(null);
861-
$group->setCode('New Group with Exclude SOAP');
862-
$group->setTaxClassId(3);
863-
$groupId = $this->createGroup($group);
864-
865-
$serviceInfo = [
866-
'soap' => [
867-
'service' => self::SERVICE_NAME,
868-
'serviceVersion' => self::SERVICE_VERSION,
869-
'operation' => 'customerGroupRepositoryV1Save',
870-
],
871-
];
872-
873-
$groupData = [
874-
CustomerGroup::ID => $groupId,
875-
CustomerGroup::CODE => 'Updated Group with Exclude SOAP',
876-
'taxClassId' => 3,
877-
'extension_attributes' => ['exclude_website_ids' => ['1']]
878-
];
879-
$this->_webApiCall($serviceInfo, ['group' => $groupData]);
880-
881-
$group = $this->groupRepository->getById($groupId);
882-
self::assertEquals($groupData[CustomerGroup::CODE], $group->getCode(), 'The group code did not change.');
883-
self::assertEquals(
884-
$groupData['taxClassId'],
885-
$group->getTaxClassId(),
886-
'The group tax class id did not change'
887-
);
888-
self::assertEquals(
889-
['1'],
890-
$group->getExtensionAttributes()->getExcludeWebsiteIds(),
891-
'The group excluded websites do not match.'
892-
);
893-
}
894-
895864
/**
896865
* Verify that updating a non-existing group throws an exception via SOAP.
897866
*/

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ResolverCache/MediaGalleryTest.php

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -587,31 +587,17 @@ public function testCacheIsInvalidatedOnProductDeletion()
587587
* @param ProductInterface $product
588588
* @return void
589589
* @throws \Zend_Cache_Exception
590+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
590591
*/
591592
private function assertCacheIdIsNotOrphanedInTagsForProduct(ProductInterface $product)
592593
{
593594
$cacheKey = $this->getCacheKeyForMediaGalleryResolver($product);
594595
$cacheLowLevelFrontend = $this->graphQlResolverCache->getLowLevelFrontend();
595596
$cacheIdPrefix = $cacheLowLevelFrontend->getOption('cache_id_prefix');
596597
$cacheBackend = $cacheLowLevelFrontend->getBackend();
597-
598-
$this->assertNotContains(
599-
$cacheIdPrefix . $cacheKey,
600-
$cacheBackend->getIdsMatchingTags([
601-
$cacheIdPrefix . 'GRAPHQL_QUERY_RESOLVER_RESULT'
602-
]),
603-
'Cache id is still present in GRAPHQL_QUERY_RESOLVER_RESULT tag file after invalidation'
604-
);
605-
606-
$this->assertNotContains(
607-
$cacheIdPrefix . $cacheKey,
608-
$cacheBackend->getIdsMatchingTags([
609-
$cacheIdPrefix . 'GQL_MEDIA_GALLERY_' . strtoupper($product->getSku()),
610-
]),
611-
sprintf(
612-
'Cache id is still present in GQL_MEDIA_GALLERY_%s tag file after invalidation',
613-
strtoupper($product->getSku())
614-
)
598+
$this->assertFalse(
599+
$this->graphQlResolverCache->test($cacheIdPrefix . 'GRAPHQL_QUERY_RESOLVER_RESULT'),
600+
'Cache id is still present after invalidation'
615601
);
616602
}
617603

dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ private function getAvailableProductCustomOption(string $productSku): array
753753
{
754754
$query = <<<QUERY
755755
{
756-
products(filter: {sku: {eq: "${productSku}"}}) {
756+
products(filter: {sku: {eq: "{$productSku}"}}) {
757757
items {
758758
name
759759
... on CustomizableProductInterface {
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
<?php
2+
/************************************************************************
3+
*
4+
* Copyright 2023 Adobe
5+
* All Rights Reserved.
6+
*
7+
* NOTICE: All information contained herein is, and remains
8+
* the property of Adobe and its suppliers, if any. The intellectual
9+
* and technical concepts contained herein are proprietary to Adobe
10+
* and its suppliers and are protected by all applicable intellectual
11+
* property laws, including trade secret and copyright laws.
12+
* Dissemination of this information or reproduction of this material
13+
* is strictly forbidden unless prior written permission is obtained
14+
* from Adobe.
15+
* ************************************************************************
16+
*/
17+
declare(strict_types=1);
18+
19+
namespace Magento\GraphQl\Quote\Guest;
20+
21+
use Magento\GraphQl\Quote\GetMaskedQuoteIdByReservedOrderId;
22+
use Magento\GraphQl\Quote\GetQuoteItemIdByReservedQuoteIdAndSku;
23+
use Magento\TestFramework\Helper\Bootstrap;
24+
use Magento\TestFramework\TestCase\GraphQlAbstract;
25+
26+
/**
27+
* Test for getting is_virtual from cart
28+
*/
29+
class GetShippingAddressWhenCartIsVirtualTest extends GraphQlAbstract
30+
{
31+
/**
32+
* @var GetMaskedQuoteIdByReservedOrderId
33+
*/
34+
private $getMaskedQuoteIdByReservedOrderId;
35+
36+
/**
37+
* @var GetQuoteItemIdByReservedQuoteIdAndSku
38+
*/
39+
private $getQuoteItemIdByReservedQuoteIdAndSku;
40+
41+
protected function setUp(): void
42+
{
43+
$objectManager = Bootstrap::getObjectManager();
44+
$this->getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
45+
$this->getQuoteItemIdByReservedQuoteIdAndSku = $objectManager->get(
46+
GetQuoteItemIdByReservedQuoteIdAndSku::class
47+
);
48+
}
49+
50+
/**
51+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
52+
* @magentoApiDataFixture Magento/Catalog/_files/product_virtual.php
53+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
54+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
55+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_virtual_product.php
56+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
57+
*/
58+
public function testGetShippingAddressForVirtualCart()
59+
{
60+
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
61+
$query = $this->getQuery($maskedQuoteId);
62+
$response = $this->graphQlQuery($query);
63+
$itemId = $this->getQuoteItemIdByReservedQuoteIdAndSku->execute('test_quote', 'simple_product');
64+
65+
$expectedShippingAddressData = [
66+
'firstname' => 'John',
67+
'lastname' => 'Smith',
68+
'company' => 'CompanyName',
69+
'street' => [
70+
'Green str, 67'
71+
],
72+
'city' => 'CityM',
73+
'region' => [
74+
'code' => 'AL',
75+
'label' => 'Alabama',
76+
],
77+
'postcode' => '75477',
78+
'country' => [
79+
'code' => 'US',
80+
'label' => 'US',
81+
],
82+
'telephone' => '3468676',
83+
'__typename' => 'ShippingCartAddress',
84+
];
85+
86+
$this->assertArrayHasKey('cart', $response);
87+
$this->assertArrayHasKey('is_virtual', $response['cart']);
88+
$this->assertFalse($response['cart']['is_virtual']);
89+
$this->assertArrayHasKey('shipping_addresses', $response['cart']);
90+
$this->assertEquals($expectedShippingAddressData, current($response['cart']['shipping_addresses']));
91+
92+
$query2 = $this->getQueryForItemRemove($maskedQuoteId, $itemId);
93+
$this->graphQlMutation($query2);
94+
$response = $this->graphQlQuery($query);
95+
96+
$this->assertArrayHasKey('cart', $response);
97+
$this->assertArrayHasKey('is_virtual', $response['cart']);
98+
$this->assertTrue($response['cart']['is_virtual']);
99+
$this->assertArrayHasKey('shipping_addresses', $response['cart']);
100+
$this->assertFalse(current($response['cart']['shipping_addresses']));
101+
}
102+
103+
/**
104+
* @param string $maskedQuoteId
105+
* @return string
106+
*/
107+
private function getQuery(string $maskedQuoteId): string
108+
{
109+
return <<<QUERY
110+
{
111+
cart(cart_id: "$maskedQuoteId") {
112+
is_virtual
113+
total_quantity
114+
items {
115+
id
116+
product {
117+
name
118+
sku
119+
}
120+
quantity
121+
errors {
122+
code
123+
message
124+
}
125+
}
126+
shipping_addresses {
127+
firstname
128+
lastname
129+
company
130+
street
131+
city
132+
region
133+
{
134+
code
135+
label
136+
}
137+
postcode
138+
country
139+
{
140+
code
141+
label
142+
}
143+
telephone
144+
__typename
145+
}
146+
}
147+
}
148+
QUERY;
149+
}
150+
151+
/**
152+
* @param string $maskedQuoteId
153+
* @param int $itemId
154+
* @return string
155+
*/
156+
private function getQueryForItemRemove(string $maskedQuoteId, int $itemId): string
157+
{
158+
return <<<QUERY
159+
mutation {
160+
removeItemFromCart(
161+
input: {
162+
cart_id: "{$maskedQuoteId}"
163+
cart_item_id: {$itemId}
164+
}
165+
) {
166+
cart {
167+
items {
168+
quantity
169+
}
170+
}
171+
}
172+
}
173+
QUERY;
174+
}
175+
}

dev/tests/integration/testsuite/Magento/GraphQl/_files/state-filter-list.php renamed to dev/tests/integration/framework/Magento/TestFramework/ApplicationStateComparator/_files/state-filter-list.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,8 @@
211211
Magento\Framework\Escaper::class => [
212212
'escaper' => null, // Note: just lazy loading without a Proxy. Should use DI instead, but not big deal
213213
],
214+
Magento\Framework\App\State\Interceptor::class => [
215+
'_areaCode' => null, // Note: _areaCode gets set after construction.
216+
],
214217
],
215218
];

0 commit comments

Comments
 (0)