Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate attribute label with default translation helper function #13251

Merged
merged 2 commits into from
Feb 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class EavTest extends AbstractModifierTest
* @var ObjectManager
*/
protected $objectManager;

/**
* @var Eav
*/
Expand Down Expand Up @@ -324,7 +324,7 @@ protected function setUp()
$this->eavAttributeMock->expects($this->any())
->method('load')
->willReturnSelf();

$this->eav =$this->getModel();
$this->objectManager->setBackwardCompatibleProperty(
$this->eav,
Expand Down Expand Up @@ -490,6 +490,10 @@ public function testSetupAttributeMetaDefaultAttribute($productId, $productRequi
->method('getNote')
->willReturn($note);

$this->productAttributeMock->expects($this->any())
->method('getDefaultFrontendLabel')
->willReturn(new Phrase('mylabel'));

$attributeMock = $this->getMockBuilder(AttributeInterface::class)
->setMethods(['getValue'])
->disableOriginalConstructor()
Expand Down Expand Up @@ -561,7 +565,7 @@ private function defaultNullProdNotNewAndRequired()
'required' => true,
'notice' => null,
'default' => null,
'label' => null,
'label' => new Phrase('mylabel'),
'code' => 'code',
'source' => 'product-details',
'scopeLabel' => '',
Expand All @@ -588,7 +592,7 @@ private function defaultNullProdNotNewAndNotRequired()
'required' => false,
'notice' => null,
'default' => null,
'label' => null,
'label' => new Phrase('mylabel'),
'code' => 'code',
'source' => 'product-details',
'scopeLabel' => '',
Expand All @@ -615,7 +619,7 @@ private function defaultNullProdNewAndNotRequired()
'required' => false,
'notice' => null,
'default' => 'required_value',
'label' => null,
'label' => new Phrase('mylabel'),
'code' => 'code',
'source' => 'product-details',
'scopeLabel' => '',
Expand All @@ -642,7 +646,7 @@ private function defaultNullProdNewAndRequired()
'required' => false,
'notice' => null,
'default' => 'required_value',
'label' => null,
'label' => new Phrase('mylabel'),
'code' => 'code',
'source' => 'product-details',
'scopeLabel' => '',
Expand All @@ -669,7 +673,7 @@ private function defaultNullProdNewAndRequiredAndFilledNotice()
'required' => false,
'notice' => __('example notice'),
'default' => 'required_value',
'label' => null,
'label' => new Phrase('mylabel'),
'code' => 'code',
'source' => 'product-details',
'scopeLabel' => '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ public function setupAttributeMeta(ProductAttributeInterface $attribute, $groupC
'required' => $attribute->getIsRequired(),
'notice' => $attribute->getNote() === null ? null : __($attribute->getNote()),
'default' => (!$this->isProductExists()) ? $attribute->getDefaultValue() : null,
'label' => $attribute->getDefaultFrontendLabel(),
'label' => __($attribute->getDefaultFrontendLabel()),
'code' => $attribute->getAttributeCode(),
'source' => $groupCode,
'scopeLabel' => $this->getScopeLabel($attribute),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Magento\Setup\Module\I18n\Dictionary;

use Magento\Framework\Component\ComponentRegistrar;
use Magento\Setup\Module\I18n\Dictionary\Generator;
use Magento\Setup\Module\I18n\ServiceLocator;

class GeneratorTest extends \PHPUnit\Framework\TestCase
Expand Down Expand Up @@ -46,6 +47,7 @@ protected function setUp()
$paths = $reflection->getProperty('paths');
$paths->setAccessible(true);
$this->backupRegistrar = $paths->getValue();
$paths->setValue(['module' => [], 'theme' => []]);
$paths->setAccessible(false);

$this->testDir = realpath(__DIR__ . '/_files');
Expand Down