Skip to content

Commit

Permalink
MAGETWO-87359: Translate attribute label with default translation hel…
Browse files Browse the repository at this point in the history
…per function #13251
  • Loading branch information
ishakhsuvarov authored Feb 6, 2018
2 parents 054d060 + edb4598 commit 44a0ec1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
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

0 comments on commit 44a0ec1

Please sign in to comment.