Skip to content

Commit

Permalink
Merge branch '2.4-develop' into 2.4-gl-graphql-v1
Browse files Browse the repository at this point in the history
  • Loading branch information
sumesh-GL authored Oct 24, 2023
2 parents aaa6731 + b9f57bd commit 224b79f
Show file tree
Hide file tree
Showing 43 changed files with 1,004 additions and 519 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<element name="minPrice" type="text" selector="span[data-price-type='minPrice']"/>
<element name="maxPrice" type="text" selector="span[data-price-type='minPrice']"/>
<element name="asLowAsFinalPrice" type="text" selector="div.price-box.price-final_price p.minimal-price > span.price-final_price span.price"/>
<element name="fixedFinalPrice" type="text" selector="div.price-box.price-final_price > span.price-final_price span.price"/>
<element name="fixedFinalPrice" type="text" selector="div.price-box.price-final_price p.price-from span.price-final_price span.price-wrapper span.price"/>
<element name="productBundleOptionsCheckbox" type="checkbox" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{childName}}')]/../input" parameterized="true" timeout="30"/>
<element name="productBundleOneOptionInput" type="input" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{childName}}')]/..//input[contains(@class, 'option')]" parameterized="true" timeout="30"/>
<element name="productBundleOptionQty" type="input" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{childName}}')]/..//input[contains(@class, 'qty')]" parameterized="true" timeout="30"/>
Expand Down
21 changes: 20 additions & 1 deletion app/code/Magento/Catalog/Helper/Product/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ private function preparePageMetadata(ResultPage $resultPage, $product)
$pageConfig = $resultPage->getConfig();

$metaTitle = $product->getMetaTitle();
$pageConfig->setMetaTitle($metaTitle);
$productMetaTitle = $metaTitle ? $this->addConfigValues($metaTitle) : null;
$pageConfig->setMetaTitle($productMetaTitle);
$pageConfig->getTitle()->set($metaTitle ?: $product->getName());

$keyword = $product->getMetaKeyword();
Expand Down Expand Up @@ -294,4 +295,22 @@ public function prepareAndRender(ResultPage $resultPage, $productId, $controller
$this->preparePageMetadata($resultPage, $product);
return $this;
}

/**
* Add Prefix and Suffix as per the configuration.
*
* @param string $title
* @return string
*/
private function addConfigValues(string $title): string
{
$preparedTitle = $this->scopeConfig->getValue(
'design/head/title_prefix',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
) . ' ' . $title . ' ' . $this->scopeConfig->getValue(
'design/head/title_suffix',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
return trim($preparedTitle);
}
}
10 changes: 1 addition & 9 deletions app/code/Magento/Catalog/Model/ProductRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
*/
protected $instancesById = [];

/**
* @var \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper
*/
protected $initializationHelper;

/**
* @var \Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory
*/
Expand Down Expand Up @@ -195,7 +190,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
/**
* ProductRepository constructor.
* @param ProductFactory $productFactory
* @param \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper
* @param \Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory $searchResultsFactory
* @param ResourceModel\Product\CollectionFactory $collectionFactory
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
Expand Down Expand Up @@ -225,7 +219,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
*/
public function __construct(
ProductFactory $productFactory,
\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper,
\Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory $searchResultsFactory,
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory,
\Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
Expand Down Expand Up @@ -253,7 +246,6 @@ public function __construct(
) {
$this->productFactory = $productFactory;
$this->collectionFactory = $collectionFactory;
$this->initializationHelper = $initializationHelper;
$this->searchResultsFactory = $searchResultsFactory;
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->resourceModel = $resourceModel;
Expand Down Expand Up @@ -940,7 +932,7 @@ private function joinPositionField(
foreach ($filterGroup->getFilters() as $filter) {
if ($filter->getField() === 'category_id') {
$filterValue = $filter->getValue();
$categoryIds[] = is_array($filterValue) ? $filterValue : explode(',', $filterValue ?? '');
$categoryIds[] = is_array($filterValue) ? $filterValue : explode(',', $filterValue);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<seeInCurrentUrl url="/{{product.urlKey}}.html" stepKey="checkUrl"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<waitForElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="waitForImage"/>
<seeElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="seeImage"/>
<waitForElement selector="{{StorefrontProductMediaSection.imageFileInGallery(image.filename)}}" stepKey="waitForImage"/>
<seeElement selector="{{StorefrontProductMediaSection.imageFileInGallery(image.filename)}}" stepKey="seeImage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<element name="oldPriceTag" type="text" selector=".old-price .price-label"/>
<element name="oldPriceAmount" type="text" selector=".old-price span.price"/>
<element name="productStockStatus" type="text" selector=".stock[title=Availability]>span"/>
<element name="productImage" type="text" selector="//*[@id='maincontent']//div[@class='gallery-placeholder']//img[@class='fotorama__img']"/>
<element name="productImageSrc" type="text" selector="//*[@id='maincontent']//div[@class='gallery-placeholder']//img[contains(@src, '{{src}}')]" parameterized="true"/>
<element name="productImage" type="text" selector="//*[@id='maincontent']//div[@class='gallery-placeholder']//img[contains(@class, 'fotorama__img')]"/>
<element name="productImageSrc" type="text" selector="//*[@id='maincontent']//div[@class='gallery-placeholder']//img[contains(@class, 'fotorama__img')][contains(@src, '{{src}}')]" parameterized="true"/>
<element name="productDescription" type="text" selector="#description .value"/>
<element name="productOptionFieldInput" type="input" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//input[@type='text']" parameterized="true"/>
<element name="productOptionAreaInput" type="textarea" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//textarea" parameterized="true"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<element name="productImage" type="text" selector="//*[@data-gallery-role='gallery' and not(contains(@class, 'fullscreen'))]//img[contains(@src, '{{filename}}') and not(contains(@class, 'full'))]" parameterized="true" />
<element name="productImageFullscreen" type="text" selector="//*[@data-gallery-role='gallery' and contains(@class, 'fullscreen')]//img[contains(@src, '{{filename}}') and contains(@class, 'full')]" parameterized="true" />
<element name="closeFullscreenImage" type="button" selector="//*[@data-gallery-role='gallery' and contains(@class, 'fullscreen')]//*[@data-gallery-role='fotorama__fullscreen-icon']" />
<element name="imageFile" type="text" selector="//*[@class='product media']//img[contains(@src, '{{filename}}')]" parameterized="true"/>
<element name="imageFile" type="text" selector="//div[contains(@class, 'fotorama__active')]//img[contains(@src, '{{filename}}')]" parameterized="true"/>
<element name="imageFileInGallery" type="text" selector="//div[contains(@class, 'fotorama__loaded--img')]//img[contains(@src, '{{filename}}')]" parameterized="true"/>
<element name="productImageActive" type="text" selector=".product.media div[data-active=true] > img[src*='{{filename}}']" parameterized="true"/>
<element name="productImageInFotorama" type="file" selector=".fotorama__nav__shaft img[src*='{{imageName}}']" parameterized="true" timeout="30"/>
<element name="fotoramaPrevButton" type="button" selector="//*[@data-gallery-role='gallery']//*[@data-gallery-role='nav-wrap']//*[@data-gallery-role='arrow' and contains(@class, 'fotorama__thumb__arr--left')]" timeout="30"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@
<waitForPageLoad stepKey="waitForStorefront"/>

<!-- See all of the images that we uploaded -->
<waitForElement selector="{{StorefrontProductMediaSection.imageFile('small')}}" stepKey="seeSmall"/>
<waitForElement selector="{{StorefrontProductMediaSection.imageFile('medium')}}" stepKey="seeMedium"/>
<waitForElement selector="{{StorefrontProductMediaSection.imageFile('large')}}" stepKey="seeLarge"/>
<waitForElement selector="{{StorefrontProductMediaSection.imageFile('gif')}}" stepKey="seeGif"/>
<waitForElement selector="{{StorefrontProductMediaSection.imageFile('jpg')}}" stepKey="seeJpg"/>
<waitForElement selector="{{StorefrontProductMediaSection.imageFile('png')}}" stepKey="seePng"/>
<waitForElement selector="{{StorefrontProductMediaSection.imageFileInGallery('small')}}" stepKey="seeSmall"/>
<waitForElement selector="{{StorefrontProductMediaSection.imageFileInGallery('medium')}}" stepKey="seeMedium"/>
<waitForElement selector="{{StorefrontProductMediaSection.imageFileInGallery('large')}}" stepKey="seeLarge"/>
<waitForElement selector="{{StorefrontProductMediaSection.imageFileInGallery('gif')}}" stepKey="seeGif"/>
<waitForElement selector="{{StorefrontProductMediaSection.imageFileInGallery('jpg')}}" stepKey="seeJpg"/>
<waitForElement selector="{{StorefrontProductMediaSection.imageFileInGallery('png')}}" stepKey="seePng"/>

<!-- Go to the category page and see a placeholder image for the second product -->
<amOnPage url="$$category.custom_attributes[url_key]$$.html" stepKey="goToCategoryPage"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class SortbyTest extends TestCase
{
const DEFAULT_ATTRIBUTE_CODE = 'attribute_name';
private const DEFAULT_ATTRIBUTE_CODE = 'attribute_name';

/**
* @var Sortby
Expand All @@ -45,7 +45,6 @@ class SortbyTest extends TestCase
*/
protected function setUp(): void
{
$this->markTestSkipped('Due to MAGETWO-48956');
$this->objectHelper = new ObjectManager($this);
$this->scopeConfig = $this->getMockForAbstractClass(ScopeConfigInterface::class);
$this->model = $this->objectHelper->getObject(
Expand Down Expand Up @@ -217,7 +216,7 @@ public function testValidateUnique(): void
{
$this->attribute->expects($this->any())->method('getName')->willReturn('attribute_name');
$this->attribute->method('getIsRequired');
$this->attribute§('getIsUnique')
$this->attribute->method('getIsUnique')
->willReturn(true);

$entityMock = $this->getMockForAbstractClass(
Expand Down
18 changes: 0 additions & 18 deletions app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ class ProductRepositoryTest extends TestCase
*/
private $model;

/**
* @var Helper|MockObject
*/
private $initializationHelper;

/**
* @var Product|MockObject
*/
Expand Down Expand Up @@ -255,7 +250,6 @@ protected function setUp(): void
->method('hasGalleryAttribute')
->willReturn(true);
$this->filterBuilder = $this->createMock(FilterBuilder::class);
$this->initializationHelper = $this->createMock(Helper::class);
$this->collectionFactory = $this->createPartialMock(CollectionFactory::class, ['create']);
$this->searchCriteriaBuilder = $this->createMock(SearchCriteriaBuilder::class);
$this->metadataService = $this->getMockForAbstractClass(ProductAttributeRepositoryInterface::class);
Expand Down Expand Up @@ -342,7 +336,6 @@ function ($value) {
ProductRepository::class,
[
'productFactory' => $this->productFactory,
'initializationHelper' => $this->initializationHelper,
'resourceModel' => $this->resourceModel,
'filterBuilder' => $this->filterBuilder,
'collectionFactory' => $this->collectionFactory,
Expand Down Expand Up @@ -723,7 +716,6 @@ public function testSaveExisting(): void
$this->productFactory->expects($this->any())
->method('create')
->willReturn($this->product);
$this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
->willReturn(true);
$this->resourceModel->expects($this->once())->method('save')->with($this->product)->willReturn(true);
Expand All @@ -748,7 +740,6 @@ public function testSaveNew(): void
$this->productFactory->expects($this->any())
->method('create')
->willReturn($this->product);
$this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
->willReturn(true);
$this->resourceModel->expects($this->once())->method('save')->with($this->product)->willReturn(true);
Expand All @@ -774,7 +765,6 @@ public function testSaveUnableToSaveException(): void
$this->productFactory->expects($this->exactly(2))
->method('create')
->willReturn($this->product);
$this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
->willReturn(true);
$this->resourceModel->expects($this->once())->method('save')->with($this->product)
Expand All @@ -800,7 +790,6 @@ public function testSaveException(): void
$this->productFactory->expects($this->exactly(2))
->method('create')
->willReturn($this->product);
$this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
->willReturn(true);

Expand Down Expand Up @@ -830,7 +819,6 @@ public function testSaveInvalidProductException(): void
$this->productFactory->expects($this->exactly(2))
->method('create')
->willReturn($this->product);
$this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
->willReturn(['error1', 'error2']);
$this->product->expects($this->once())->method('getId')->willReturn(null);
Expand All @@ -854,8 +842,6 @@ public function testSaveThrowsTemporaryStateExceptionIfDatabaseConnectionErrorOc
$this->productFactory->expects($this->any())
->method('create')
->willReturn($this->product);
$this->initializationHelper->expects($this->never())
->method('initialize');
$this->resourceModel->expects($this->once())
->method('validate')
->with($this->product)
Expand Down Expand Up @@ -1018,7 +1004,6 @@ public function testSaveExistingWithOptions(array $newOptions): void
$this->productFactory->expects($this->any())
->method('create')
->willReturn($this->initializedProduct);
$this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->initializedProduct)
->willReturn(true);
$this->resourceModel->expects($this->once())->method('save')
Expand Down Expand Up @@ -1184,7 +1169,6 @@ public function testSaveWithLinks(array $newLinks, array $existingLinks, array $
$this->productFactory->expects($this->any())
->method('create')
->willReturn($this->initializedProduct);
$this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->initializedProduct)
->willReturn(true);
$this->resourceModel->expects($this->once())->method('save')
Expand Down Expand Up @@ -1354,7 +1338,6 @@ protected function setupProductMocksForSave(): void
$this->productFactory->expects($this->any())
->method('create')
->willReturn($this->initializedProduct);
$this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->initializedProduct)
->willReturn(true);
$this->resourceModel->expects($this->once())->method('save')
Expand Down Expand Up @@ -1475,7 +1458,6 @@ public function testSaveWithDifferentWebsites(): void
$this->productFactory->expects($this->any())
->method('create')
->willReturn($this->product);
$this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
->willReturn(true);
$this->resourceModel->expects($this->once())->method('save')->with($this->product)->willReturn(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
use Magento\Framework\View\Element\UiComponent\ContextInterface;

/**
* Class Thumbnail
* Class prepares Thumbnail
*
* @api
* @since 100.0.2
*/
class Thumbnail extends \Magento\Ui\Component\Listing\Columns\Column
{
const NAME = 'thumbnail';
public const NAME = 'thumbnail';

const ALT_FIELD = 'name';
public const ALT_FIELD = 'name';

/**
* @var \Magento\Catalog\Helper\Image
Expand Down Expand Up @@ -77,7 +77,6 @@ public function prepareDataSource(array $dataSource)

return $dataSource;
}

/**
* Get Alt
*
Expand All @@ -88,6 +87,7 @@ public function prepareDataSource(array $dataSource)
protected function getAlt($row)
{
$altField = $this->getData('config/altField') ?: self::ALT_FIELD;
return $row[$altField] ?? null;
// phpcs:disable Magento2.Functions.DiscouragedFunction
return html_entity_decode($row[$altField], ENT_QUOTES, "UTF-8") ?? null;
}
}
Loading

0 comments on commit 224b79f

Please sign in to comment.