Skip to content

Commit f2bd17a

Browse files
committed
MAGETWO-35264: Unable to request Soap service without plugging in CustomAttributeMap config
- Added unit test - Removed redundant di config - Updated api name
1 parent 117951c commit f2bd17a

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed

app/code/Magento/Eav/Model/EavCustomAttributeTypeLocator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function getType($attributeCode, $serviceClass)
7373
/**
7474
* {@inheritdoc}
7575
*/
76-
public function getAllServiceDataInterface()
76+
public function getAllServiceDataInterfaces()
7777
{
7878
$dataInterfaceArray = [];
7979
if (!$this->serviceBackendModelDataInterfaceMap) {

app/code/Magento/Eav/Test/Unit/Model/EavCustomAttributeTypeLocatorTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,25 @@ public function getTypeDataProvider()
147147
]
148148
];
149149
}
150+
151+
public function testGetAllServiceDataInterfaceEmpty()
152+
{
153+
$this->eavCustomAttributeTypeLocator = new EavCustomAttributeTypeLocator($this->attributeRepository);
154+
$this->assertEmpty($this->eavCustomAttributeTypeLocator->getAllServiceDataInterfaces());
155+
}
156+
157+
public function testGetAllServiceDataInterface()
158+
{
159+
$serviceBackendModelDataInterfaceMapData = [
160+
'ServiceA' => ['BackedA' => 'ServiceDataInterfaceA'],
161+
'ServiceB' => ['BackedB' => 'ServiceDataInterfaceB'],
162+
'ServiceC' => ['BackedC' => 'ServiceDataInterfaceC']
163+
];
164+
$this->eavCustomAttributeTypeLocator = new EavCustomAttributeTypeLocator(
165+
$this->attributeRepository, [], $serviceBackendModelDataInterfaceMapData);
166+
$this->assertEquals(
167+
['ServiceDataInterfaceA', 'ServiceDataInterfaceB', 'ServiceDataInterfaceC'],
168+
$this->eavCustomAttributeTypeLocator->getAllServiceDataInterfaces()
169+
);
170+
}
150171
}

app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ protected function _generate($requestedServices, $endPointUrl)
178178
*/
179179
protected function addCustomAttributeTypes($wsdl)
180180
{
181-
foreach ($this->customAttributeTypeLocator->getAllServiceDataInterface() as $customAttributeClass) {
181+
foreach ($this->customAttributeTypeLocator->getAllServiceDataInterfaces() as $customAttributeClass) {
182182
$typeName = $this->_typeProcessor->register($customAttributeClass);
183183
$wsdl->addComplexType($typeName);
184184
}

app/code/Magento/Webapi/etc/di.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
<argument name="cache" xsi:type="object">Magento\Framework\App\Cache\Type\Webapi</argument>
2828
</arguments>
2929
</type>
30-
<type name="Magento\Webapi\Model\Soap\Wsdl\Generator" />
3130
<type name="Magento\Integration\Model\ConfigBasedIntegrationManager">
3231
<plugin name="webapiSetup" type="Magento\Webapi\Model\Plugin\Manager" />
3332
</type>

lib/internal/Magento/Framework/Webapi/CustomAttributeTypeLocatorInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function getType($attributeCode, $serviceClass);
2323
/**
2424
* Get list of all Data Interface corresponding to complex custom attribute types
2525
*
26-
* @return array
26+
* @return string[] array of Data Interface class names
2727
*/
28-
public function getAllServiceDataInterface();
28+
public function getAllServiceDataInterfaces();
2929
}

0 commit comments

Comments
 (0)