Skip to content

Commit 1b1baf1

Browse files
authored
Merge pull request #10028 from magento-gl/spartans_pr_16082025
[Spartans] Bug Fix Deliver
2 parents ec9459d + 617937c commit 1b1baf1

File tree

22 files changed

+418
-239
lines changed

22 files changed

+418
-239
lines changed

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public function get($sku, $editMode = false, $storeId = null, $forceReload = fal
285285
$productId = $this->resourceModel->getIdBySku($sku);
286286
if (!$productId) {
287287
throw new NoSuchEntityException(
288-
__("The product that was requested doesn't exist. Verify the product and try again.")
288+
__('The product with SKU "%1" does not exist.', $sku)
289289
);
290290
}
291291
if ($editMode) {
@@ -319,7 +319,7 @@ public function getById($productId, $editMode = false, $storeId = null, $forceRe
319319
$product->load($productId);
320320
if (!$product->getId()) {
321321
throw new NoSuchEntityException(
322-
__("The product that was requested doesn't exist. Verify the product and try again.")
322+
__('The product with ID "%1" does not exist.', $productId)
323323
);
324324
}
325325
$this->cacheProduct($cacheKey, $product);

app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
*/
2525
class ManagementTest extends TestCase
2626
{
27-
const STUB_PRODUCT_SKU_1 = 'Simple Product 1';
28-
const STUB_PRODUCT_SKU_2 = 'Simple Product 2';
29-
const STUB_PRODUCT_TYPE = 'simple';
30-
const STUB_LINK_TYPE = 'related';
31-
const STUB_BAD_TYPE = 'bad type';
27+
private const STUB_PRODUCT_SKU_1 = 'Simple Product 1';
28+
private const STUB_PRODUCT_SKU_2 = 'Simple Product 2';
29+
private const STUB_PRODUCT_TYPE = 'simple';
30+
private const STUB_LINK_TYPE = 'related';
31+
private const STUB_BAD_TYPE = 'bad type';
3232

3333
/**
3434
* @var Management
@@ -289,13 +289,13 @@ public function testSetProductLinksNoProductException()
289289
->method('get')
290290
->willThrowException(
291291
new NoSuchEntityException(
292-
__("The product that was requested doesn't exist. Verify the product and try again.")
292+
__('The product with SKU "' . $productSku . '" does not exist.')
293293
)
294294
);
295295

296296
$this->expectException(NoSuchEntityException::class);
297297
$this->expectExceptionMessage(
298-
"The product that was requested doesn't exist. Verify the product and try again."
298+
'The product with SKU "' . $productSku . '" does not exist.'
299299
);
300300

301301
$this->model->setProductLinks($productSku, $links);

app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ public function testGetAbsentProduct(): void
440440
{
441441
$this->expectException('Magento\Framework\Exception\NoSuchEntityException');
442442
$this->expectExceptionMessage(
443-
'The product that was requested doesn\'t exist. Verify the product and try again.'
443+
'The product with SKU "test_sku" does not exist.'
444444
);
445445
$this->productFactory->expects($this->once())->method('create')
446446
->willReturn($this->product);
@@ -521,7 +521,7 @@ public function testGetByIdAbsentProduct(): void
521521
{
522522
$this->expectException('Magento\Framework\Exception\NoSuchEntityException');
523523
$this->expectExceptionMessage(
524-
'The product that was requested doesn\'t exist. Verify the product and try again.'
524+
'The product with ID "product_id" does not exist.'
525525
);
526526
$this->productFactory->expects($this->once())->method('create')
527527
->willReturn($this->product);

app/code/Magento/Catalog/i18n/en_US.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,8 @@ Search,Search
436436
"Product with SKU '%1' is not linked to product with SKU '%2'","Product with SKU '%1' is not linked to product with SKU '%2'"
437437
"Product %1 doesn't have linked %2 as %3","Product %1 doesn't have linked %2 as %3"
438438
"The product that was requested doesn't exist. Verify the product and try again.","The product that was requested doesn't exist. Verify the product and try again."
439+
"The product with SKU ""%1"" does not exist.","The product with SKU ""%1"" does not exist."
440+
"The product with ID ""%1"" does not exist.","The product with ID ""%1"" does not exist."
439441
"The Product with the ""%1"" SKU doesn't exist.","The Product with the ""%1"" SKU doesn't exist."
440442
"Invalid product data: %1","Invalid product data: %1"
441443
"The ""%1"" product couldn't be removed.","The ""%1"" product couldn't be removed."

app/code/Magento/Theme/view/frontend/templates/html/sections.phtml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,20 @@ $groupCss = $block->getGroupCss();
2727
$label = $block->getChildData($alias, 'title');
2828
?>
2929
<div class="section-item-title <?= $escaper->escapeHtmlAttr($groupCss) ?>-item-title"
30-
data-role="collapsible">
30+
data-role="collapsible"
31+
aria-controls="<?= $escaper->escapeHtmlAttr($alias) ?>"
32+
aria-expanded="false">
3133
<a class="<?= $escaper->escapeHtmlAttr($groupCss) ?>-item-switch"
32-
data-toggle="switch" href="#<?= $escaper->escapeHtmlAttr($alias) ?>">
34+
data-toggle="switch"
35+
href="#<?= $escaper->escapeHtmlAttr($alias) ?>">
3336
<?= /* @noEscape */ $label ?>
3437
</a>
3538
</div>
3639
<div class="section-item-content <?= $escaper->escapeHtmlAttr($groupCss) ?>-item-content"
3740
id="<?= $escaper->escapeHtmlAttr($alias) ?>"
38-
role="tab">
41+
role="tabpanel"
42+
aria-hidden="true"
43+
style="display: none;">
3944
<?= /* @noEscape */ $html ?>
4045
</div>
4146
<?php endforeach;?>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\UrlRewrite\Test\Fixture;
9+
10+
use Magento\Cms\Api\PageRepositoryInterface;
11+
use Magento\Cms\Model\PageFactory;
12+
use Magento\Framework\DataObject;
13+
use Magento\TestFramework\Fixture\Api\DataMerger;
14+
use Magento\TestFramework\Fixture\RevertibleDataFixtureInterface;
15+
16+
class CmsPage implements RevertibleDataFixtureInterface
17+
{
18+
private const DEFAULT_DATA = [
19+
'title' => 'CMS Test Page',
20+
'identifier' => 'cms-test-page',
21+
'stores' => [0],
22+
'is_active' => 0, // Key difference - disabled by default
23+
'content' => '<h1>This is a disabled CMS page</h1><p>This page should not be accessible via GraphQL.</p>',
24+
'content_heading' => 'Disabled Page Heading',
25+
'page_layout' => '1column',
26+
'meta_title' => 'Disabled Page Meta Title',
27+
'meta_keywords' => 'disabled, cms, page, test, graphql',
28+
'meta_description' => 'This is a disabled CMS page used for GraphQL error handling tests'
29+
];
30+
31+
/**
32+
* @param PageFactory $pageFactory
33+
* @param PageRepositoryInterface $pageRepository
34+
* @param DataMerger $dataMerger
35+
*/
36+
public function __construct(
37+
private readonly PageFactory $pageFactory,
38+
private readonly PageRepositoryInterface $pageRepository,
39+
private readonly DataMerger $dataMerger,
40+
) {
41+
}
42+
43+
/**
44+
* @inheritdoc
45+
*/
46+
public function apply(array $data = []): ?DataObject
47+
{
48+
$data = $this->dataMerger->merge(self::DEFAULT_DATA, $data);
49+
50+
$page = $this->pageFactory->create();
51+
$page->setTitle($data['title'])
52+
->setIdentifier($data['identifier'])
53+
->setStores($data['stores'])
54+
->setIsActive($data['is_active'])
55+
->setContent($data['content'])
56+
->setContentHeading($data['content_heading'])
57+
->setPageLayout($data['page_layout'])
58+
->setMetaTitle($data['meta_title'])
59+
->setMetaKeywords($data['meta_keywords'])
60+
->setMetaDescription($data['meta_description']);
61+
62+
$this->pageRepository->save($page);
63+
64+
return $page;
65+
}
66+
67+
/**
68+
* @inheritdoc
69+
*/
70+
public function revert(DataObject $data): void
71+
{
72+
$this->pageRepository->delete($data);
73+
}
74+
}

app/code/Magento/UrlRewriteGraphQl/Model/Resolver/Route.php

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2020 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

88
namespace Magento\UrlRewriteGraphQl\Model\Resolver;
99

10+
use Magento\Framework\Exception\NoSuchEntityException;
1011
use Magento\Framework\GraphQl\Config\Element\Field;
1112
use Magento\Framework\GraphQl\Query\ResolverInterface;
1213
use Magento\Framework\GraphQl\Query\Uid;
@@ -58,19 +59,23 @@ public function resolve(
5859
);
5960
$storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
6061
if ($resultArray) {
61-
$result = [];
62-
if (isset($resultArray['type'])) {
63-
$result = $this->entityDataProviderComposite->getData(
64-
$resultArray['type'],
65-
(int)$resultArray['id'],
66-
$info,
67-
$storeId
68-
);
62+
try {
63+
$result = [];
64+
if (isset($resultArray['type'])) {
65+
$result = $this->entityDataProviderComposite->getData(
66+
$resultArray['type'],
67+
(int)$resultArray['id'],
68+
$info,
69+
$storeId
70+
);
71+
}
72+
$result['redirect_code'] = $resultArray['redirect_code'];
73+
$result['relative_url'] = $resultArray['relative_url'];
74+
$result['type'] = $resultArray['type'];
75+
return $result;
76+
} catch (NoSuchEntityException) {
77+
return null;
6978
}
70-
$result['redirect_code'] = $resultArray['redirect_code'];
71-
$result['relative_url'] = $resultArray['relative_url'];
72-
$result['type'] = $resultArray['type'];
73-
return $result;
7479
}
7580
return null;
7681
}

0 commit comments

Comments
 (0)