Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
api-functional
testsuite
Magento
Catalog
Api
ProductMediaAttributeManagementTest.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Catalog\Api
;
8
9
use
Magento\TestFramework\TestCase\WebapiAbstract
;
10
11
class
ProductMediaAttributeManagementTest
extends
WebapiAbstract
12
{
16
public
function
testGetList
()
17
{
18
$attributeSetName =
'attribute_set_with_media_attribute'
;
19
$serviceInfo = [
20
'rest'
=> [
21
'resourcePath'
=>
'/V1/products/media/types/'
. $attributeSetName,
22
'httpMethod'
=>
\Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET
,
23
],
24
'soap'
=> [
25
'service'
=>
'catalogProductMediaAttributeManagementV1'
,
26
'serviceVersion'
=>
'V1'
,
27
'operation'
=>
'catalogProductMediaAttributeManagementV1GetList'
,
28
],
29
];
30
31
$requestData
= [
32
'attributeSetName'
=> $attributeSetName,
33
];
34
35
$mediaAttributes = $this->
_webApiCall
($serviceInfo,
$requestData
);
36
37
$this->assertNotEmpty($mediaAttributes);
38
$attribute
= $this->
getAttributeByCode
($mediaAttributes,
'funny_image'
);
39
$this->assertNotNull(
$attribute
);
40
$this->assertEquals(
'Funny image'
,
$attribute
[
'default_frontend_label'
]);
41
$this->assertEquals(1,
$attribute
[
'is_user_defined'
]);
42
}
43
51
protected
function
getAttributeByCode
($attributeList,
$attributeCode
)
52
{
53
foreach
($attributeList as
$attribute
) {
54
if
(
$attributeCode
==
$attribute
[
'attribute_code'
]) {
55
return
$attribute
;
56
}
57
}
58
59
return
null
;
60
}
61
}
Magento\Catalog\Api
Definition:
AttributeSetManagementTest.php:7
$requestData
$requestData
Definition:
order_configurable_product.php:31
Magento\TestFramework\TestCase\WebapiAbstract\_webApiCall
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
Definition:
WebapiAbstract.php:165
$attribute
$attribute
Definition:
attribute_set_with_image_attribute.php:41
Magento\Catalog\Api\ProductMediaAttributeManagementTest
Definition:
ProductMediaAttributeManagementTest.php:11
Magento\Framework\Webapi\Rest\Request\HTTP_METHOD_GET
const HTTP_METHOD_GET
Definition:
Request.php:19
Magento\Catalog\Api\ProductMediaAttributeManagementTest\getAttributeByCode
getAttributeByCode($attributeList, $attributeCode)
Definition:
ProductMediaAttributeManagementTest.php:51
$attributeCode
$attributeCode
Definition:
extend.phtml:12
Magento\TestFramework\TestCase\WebapiAbstract
Definition:
WebapiAbstract.php:19
Magento\Catalog\Api\ProductMediaAttributeManagementTest\testGetList
testGetList()
Definition:
ProductMediaAttributeManagementTest.php:16