25 'resourcePath' => self::RESOURCE_PATH .
'/' .
$attributeSetId .
'/attributes',
31 'operation' => self::SERVICE_NAME .
'GetAttributes',
37 $this->assertArrayHasKey(
'attribute_code',
$attributes[0]);
38 $this->assertArrayHasKey(
'attribute_id',
$attributes[0]);
39 $this->assertArrayHasKey(
'default_frontend_label',
$attributes[0]);
40 $this->assertNotNull(
$attributes[0][
'attribute_code']);
41 $this->assertNotNull(
$attributes[0][
'attribute_id']);
42 $this->assertNotNull(
$attributes[0][
'default_frontend_label']);
58 $payload[
'attributeSetId'] = -1;
60 $expectedMessage =
'The AttributeSet with a "%1" ID doesn\'t exist. Verify the attributeSet and try again.';
64 $this->fail(
"Expected exception");
65 }
catch (\SoapFault $e) {
66 $this->assertContains(
69 "SoapFault does not contain expected message." 71 }
catch (\Exception $e) {
73 $this->assertEquals($expectedMessage, $errorObj[
'message']);
74 $this->assertEquals([$payload[
'attributeSetId']], $errorObj[
'parameters']);
75 $this->assertEquals(HTTPExceptionCodes::HTTP_NOT_FOUND, $e->getCode());
82 $payload[
'attributeGroupId'] = -1;
83 $expectedMessage =
'The group with the "%1" ID doesn\'t exist. Verify the ID and try again.';
87 $this->fail(
"Expected exception");
88 }
catch (\SoapFault $e) {
89 $this->assertContains(
92 "SoapFault does not contain expected message." 94 }
catch (\Exception $e) {
96 $this->assertEquals($expectedMessage, $errorObj[
'message']);
97 $this->assertEquals([$payload[
'attributeGroupId']], $errorObj[
'parameters']);
98 $this->assertEquals(HTTPExceptionCodes::HTTP_NOT_FOUND, $e->getCode());
105 $payload[
'attributeCode'] =
'badCode';
107 'The attribute with a "%1" attributeCode doesn\'t exist. Verify the attribute and try again.';
111 $this->fail(
"Expected exception");
112 }
catch (\SoapFault $e) {
113 $this->assertContains(
116 "SoapFault does not contain expected message." 118 }
catch (\Exception $e) {
120 $this->assertEquals($expectedMessage, $errorObj[
'message']);
121 $this->assertEquals([$payload[
'attributeCode']], $errorObj[
'parameters']);
122 $this->assertEquals(HTTPExceptionCodes::HTTP_NOT_FOUND, $e->getCode());
126 public function testUnassignAttribute()
133 $attributeManagement->assign(
134 \
Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE,
135 $payload[
'attributeSetId'],
136 $payload[
'attributeGroupId'],
137 $payload[
'attributeCode'],
138 $payload[
'sortOrder']
143 'resourcePath' => self::RESOURCE_PATH .
144 '/' . $payload[
'attributeSetId'] .
146 $payload[
'attributeCode'],
152 'operation' => self::SERVICE_NAME .
'Unassign',
159 'attributeSetId' => $payload[
'attributeSetId'],
160 'attributeCode' => $payload[
'attributeCode'],
169 'attributeSetId' => 4,
170 'attributeGroupId' => 8,
171 'attributeCode' =>
'cost',
180 'resourcePath' => self::RESOURCE_PATH .
'/attributes',
186 'operation' => self::SERVICE_NAME .
'Assign',
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
testAssignAttributeWrongAttribute()
processRestExceptionResult(\Exception $e)
testAssignAttributeWrongAttributeGroup()
testAssignAttributeWrongAttributeSet()
static getObjectManager()