Skip to content

Commit 17548f1

Browse files
committed
Merge remote-tracking branch 'tango/MC-17824' into Chaika-PR-2019-08-29
2 parents 9cb846b + d857a23 commit 17548f1

File tree

2 files changed

+71
-5
lines changed

2 files changed

+71
-5
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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\Msrp\Setup\Patch\Data;
9+
10+
use Magento\Catalog\Model\Product;
11+
use Magento\Catalog\Setup\CategorySetupFactory;
12+
use Magento\Framework\Setup\Patch\DataPatchInterface;
13+
14+
/**
15+
* Change label for MSRP attribute.
16+
*/
17+
class ChangeMsrpAttributeLabel implements DataPatchInterface
18+
{
19+
/**
20+
* @var CategorySetupFactory
21+
*/
22+
private $categorySetupFactory;
23+
24+
/**
25+
* @param CategorySetupFactory $categorySetupFactory
26+
*/
27+
public function __construct(CategorySetupFactory $categorySetupFactory)
28+
{
29+
$this->categorySetupFactory = $categorySetupFactory;
30+
}
31+
32+
/**
33+
* @inheritdoc
34+
*/
35+
public function apply()
36+
{
37+
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
38+
$categorySetup = $this->categorySetupFactory->create();
39+
$entityTypeId = $categorySetup->getEntityTypeId(Product::ENTITY);
40+
$msrpAttribute = $categorySetup->getAttribute($entityTypeId, 'msrp');
41+
$categorySetup->updateAttribute(
42+
$entityTypeId,
43+
$msrpAttribute['attribute_id'],
44+
'frontend_label',
45+
'Minimum Advertised Price'
46+
);
47+
}
48+
49+
/**
50+
* @inheritdoc
51+
*/
52+
public static function getDependencies()
53+
{
54+
return [
55+
InitializeMsrpAttributes::class,
56+
];
57+
}
58+
59+
/**
60+
* @inheritdoc
61+
*/
62+
public function getAliases()
63+
{
64+
return [];
65+
}
66+
}

dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertProductEditPageAdvancedPricingFields.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
use Magento\Mtf\Fixture\FixtureInterface;
1212

1313
/**
14-
* Check "Manufacturer's Suggested Retail Price" field on "Advanced pricing" page.
14+
* Check "Minimum Advertised Price" field on "Advanced pricing" page.
1515
*/
1616
class AssertProductEditPageAdvancedPricingFields extends AbstractConstraint
1717
{
1818
/**
19-
* Title of "Manufacturer's Suggested Retail Price" field.
19+
* Title of "Minimum Advertised Price" field.
2020
*
2121
* @var string
2222
*/
23-
private $manufacturerFieldTitle = 'Manufacturer\'s Suggested Retail Price';
23+
private $manufacturerFieldTitle = 'Minimum Advertised Price';
2424

2525
/**
2626
* @param CatalogProductEdit $catalogProductEdit
@@ -35,7 +35,7 @@ public function processAssert(CatalogProductEdit $catalogProductEdit, FixtureInt
3535

3636
\PHPUnit\Framework\Assert::assertTrue(
3737
$advancedPricing->checkField($this->manufacturerFieldTitle),
38-
'"Manufacturer\'s Suggested Retail Price" field is not correct.'
38+
'"Minimum Advertised Price" field is not correct.'
3939
);
4040
}
4141

@@ -46,6 +46,6 @@ public function processAssert(CatalogProductEdit $catalogProductEdit, FixtureInt
4646
*/
4747
public function toString()
4848
{
49-
return '"Manufacturer\'s Suggested Retail Price" field is correct.';
49+
return '"Minimum Advertised Price" field is correct.';
5050
}
5151
}

0 commit comments

Comments
 (0)