Skip to content

Commit 2f3d7b6

Browse files
MAGETWO-64315: [API] catalogProductAttributeRepository does not return "frontend_labels" value
1 parent df6f198 commit 2f3d7b6

File tree

4 files changed

+54
-3
lines changed

4 files changed

+54
-3
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ class RepositoryTest extends \PHPUnit\Framework\TestCase
7171
*/
7272
private $optionManagementMock;
7373

74+
/**
75+
* @inheritdoc
76+
*/
7477
protected function setUp()
7578
{
7679
$this->attributeResourceMock =
@@ -115,6 +118,9 @@ protected function setUp()
115118
);
116119
}
117120

121+
/**
122+
* @return void
123+
*/
118124
public function testGet()
119125
{
120126
$attributeCode = 'some attribute code';
@@ -127,6 +133,9 @@ public function testGet()
127133
$this->model->get($attributeCode);
128134
}
129135

136+
/**
137+
* @return void
138+
*/
130139
public function testGetList()
131140
{
132141
$searchCriteriaMock = $this->createMock(\Magento\Framework\Api\SearchCriteria::class);
@@ -140,6 +149,9 @@ public function testGetList()
140149
$this->model->getList($searchCriteriaMock);
141150
}
142151

152+
/**
153+
* @return void
154+
*/
143155
public function testDelete()
144156
{
145157
$attributeMock = $this->createMock(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class);
@@ -148,6 +160,9 @@ public function testDelete()
148160
$this->assertEquals(true, $this->model->delete($attributeMock));
149161
}
150162

163+
/**
164+
* @return void
165+
*/
151166
public function testDeleteById()
152167
{
153168
$attributeCode = 'some attribute code';
@@ -163,6 +178,9 @@ public function testDeleteById()
163178
$this->assertEquals(true, $this->model->deleteById($attributeCode));
164179
}
165180

181+
/**
182+
* @return void
183+
*/
166184
public function testGetCustomAttributesMetadata()
167185
{
168186
$searchCriteriaMock = $this->createMock(\Magento\Framework\Api\SearchCriteria::class);
@@ -243,6 +261,9 @@ public function testSaveInputExceptionInvalidFieldValue()
243261
$this->model->save($attributeMock);
244262
}
245263

264+
/**
265+
* @return void
266+
*/
246267
public function testSaveDoesNotSaveAttributeOptionsIfOptionsAreAbsentInPayload()
247268
{
248269
$attributeId = 1;
@@ -268,6 +289,9 @@ public function testSaveDoesNotSaveAttributeOptionsIfOptionsAreAbsentInPayload()
268289
$this->model->save($attributeMock);
269290
}
270291

292+
/**
293+
* @return void
294+
*/
271295
public function testSaveSavesDefaultFrontendLabelIfItIsPresentInPayload()
272296
{
273297
$labelMock = $this->createMock(\Magento\Eav\Api\Data\AttributeFrontendLabelInterface::class);

app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens
167167
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
168168
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
169169
* @param array $data
170-
* @param FrontendLabelFactory|null $frontendLabelFactory
171170
* @param \Magento\Eav\Api\Data\AttributeExtensionFactory|null $eavExtensionFactory
171+
* @param FrontendLabelFactory|null $frontendLabelFactory
172172
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
173173
* @codeCoverageIgnore
174174
*/
@@ -188,8 +188,8 @@ public function __construct(
188188
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
189189
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
190190
array $data = [],
191-
FrontendLabelFactory $frontendLabelFactory = null,
192-
\Magento\Eav\Api\Data\AttributeExtensionFactory $eavExtensionFactory = null
191+
\Magento\Eav\Api\Data\AttributeExtensionFactory $eavExtensionFactory = null,
192+
FrontendLabelFactory $frontendLabelFactory = null
193193
) {
194194
parent::__construct(
195195
$context,

app/code/Magento/Eav/Test/Unit/Model/Entity/AttributeTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ class AttributeTest extends \PHPUnit\Framework\TestCase
1313
*/
1414
protected $_model;
1515

16+
/**
17+
* @inheritdoc
18+
*/
1619
protected function setUp()
1720
{
1821
$this->_model = $this->createPartialMock(\Magento\Eav\Model\Entity\Attribute::class, ['__wakeup']);
1922
}
2023

24+
/**
25+
* @inheritdoc
26+
*/
2127
protected function tearDown()
2228
{
2329
$this->_model = null;
@@ -27,6 +33,7 @@ protected function tearDown()
2733
* @param string $givenFrontendInput
2834
* @param string $expectedBackendType
2935
* @dataProvider dataGetBackendTypeByInput
36+
* @return void
3037
*/
3138
public function testGetBackendTypeByInput($givenFrontendInput, $expectedBackendType)
3239
{
@@ -113,6 +120,9 @@ public function getSortWeightDataProvider()
113120
];
114121
}
115122

123+
/**
124+
* return void
125+
*/
116126
public function testGetFrontendLabels()
117127
{
118128
$attributeId = 1;

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeRepositoryTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class ProductAttributeRepositoryTest extends \Magento\TestFramework\TestCase\Web
2323

2424
/**
2525
* @magentoApiDataFixture Magento/Catalog/_files/product_attribute.php
26+
* @return void
2627
*/
2728
public function testGet()
2829
{
@@ -35,6 +36,9 @@ public function testGet()
3536
$this->assertEquals($attributeCode, $attribute['attribute_code']);
3637
}
3738

39+
/**
40+
* @return void
41+
*/
3842
public function testGetList()
3943
{
4044
$searchCriteria = [
@@ -83,6 +87,7 @@ public function testGetList()
8387

8488
/**
8589
* @magentoApiDataFixture Magento/Catalog/Model/Product/Attribute/_files/create_attribute_service.php
90+
* @return void
8691
*/
8792
public function testCreate()
8893
{
@@ -117,6 +122,7 @@ public function testCreate()
117122

118123
/**
119124
* @magentoApiDataFixture Magento/Catalog/_files/product_attribute.php
125+
* @return void
120126
*/
121127
public function testCreateWithExceptionIfAttributeAlreadyExists()
122128
{
@@ -133,6 +139,7 @@ public function testCreateWithExceptionIfAttributeAlreadyExists()
133139

134140
/**
135141
* @magentoApiDataFixture Magento/Catalog/Model/Product/Attribute/_files/create_attribute_service.php
142+
* @return void
136143
*/
137144
public function testUpdate()
138145
{
@@ -202,6 +209,7 @@ public function testUpdate()
202209

203210
/**
204211
* @magentoApiDataFixture Magento/Catalog/Model/Product/Attribute/_files/create_attribute_service.php
212+
* @return void
205213
*/
206214
public function testUpdateWithNoDefaultLabelAndAdminStorelabel()
207215
{
@@ -234,6 +242,7 @@ public function testUpdateWithNoDefaultLabelAndAdminStorelabel()
234242

235243
/**
236244
* @magentoApiDataFixture Magento/Catalog/Model/Product/Attribute/_files/create_attribute_service.php
245+
* @return void
237246
*/
238247
public function testUpdateWithNoDefaultLabelAndNoAdminStoreLabel()
239248
{
@@ -265,6 +274,7 @@ public function testUpdateWithNoDefaultLabelAndNoAdminStoreLabel()
265274

266275
/**
267276
* @magentoApiDataFixture Magento/Catalog/Model/Product/Attribute/_files/create_attribute_service.php
277+
* @return void
268278
*/
269279
public function testUpdateWithNewOption()
270280
{
@@ -302,13 +312,17 @@ public function testUpdateWithNewOption()
302312

303313
/**
304314
* @magentoApiDataFixture Magento/Catalog/_files/product_attribute.php
315+
* @return void
305316
*/
306317
public function testDeleteById()
307318
{
308319
$attributeCode = 'test_attribute_code_333';
309320
$this->assertTrue($this->deleteAttribute($attributeCode));
310321
}
311322

323+
/**
324+
* @return void
325+
*/
312326
public function testDeleteNoSuchEntityException()
313327
{
314328
$attributeCode = 'some_test_code';
@@ -490,6 +504,9 @@ protected function updateAttribute($attributeCode, $attributeData)
490504
return $this->_webApiCall($serviceInfo, $attributeData);
491505
}
492506

507+
/**
508+
* @inheritdoc
509+
*/
493510
protected function tearDown()
494511
{
495512
foreach ($this->createdAttributes as $attributeCode) {

0 commit comments

Comments
 (0)