Skip to content

Commit 8e6083d

Browse files
author
Eric Bohanon
committed
MAGETWO-83872: Write metadata service
1 parent f024013 commit 8e6083d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class ServiceInputProcessor implements ServicePayloadConverterInterface
7373
* @param AttributeValueFactory $attributeValueFactory
7474
* @param CustomAttributeTypeLocatorInterface $customAttributeTypeLocator
7575
* @param MethodsMap $methodsMap
76-
* @param array $serviceTypeToEntityTypeMap
76+
* @param ServiceTypeToEntityTypeMap $serviceTypeToEntityTypeMap
7777
*/
7878
public function __construct(
7979
TypeProcessor $typeProcessor,

lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\Framework\Serialize\SerializerInterface;
1010
use Magento\Framework\Webapi\ServiceInputProcessor;
11+
use Magento\Framework\Webapi\ServiceTypeToEntityTypeMap;
1112
use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\WebapiBuilderFactory;
1213
use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\AssociativeArray;
1314
use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\DataArray;
@@ -44,6 +45,11 @@ class ServiceInputProcessorTest extends \PHPUnit\Framework\TestCase
4445
/** @var \PHPUnit_Framework_MockObject_MockObject */
4546
protected $fieldNamer;
4647

48+
/**
49+
* @var ServiceTypeToEntityTypeMap|\PHPUnit_Framework_MockObject_MockObject
50+
*/
51+
private $serviceTypeToEntityTypeMap;
52+
4753
protected function setUp()
4854
{
4955
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
@@ -107,6 +113,9 @@ function () use ($objectManager) {
107113
'serializer',
108114
$serializerMock
109115
);
116+
$this->serviceTypeToEntityTypeMap = $this->getMockBuilder(ServiceTypeToEntityTypeMap::class)
117+
->disableOriginalConstructor()
118+
->getMock();
110119

111120
$this->serviceInputProcessor = $objectManager->getObject(
112121
\Magento\Framework\Webapi\ServiceInputProcessor::class,
@@ -116,10 +125,7 @@ function () use ($objectManager) {
116125
'customAttributeTypeLocator' => $this->customAttributeTypeLocator,
117126
'attributeValueFactory' => $this->attributeValueFactoryMock,
118127
'methodsMap' => $this->methodsMap,
119-
'dataInterfaceToEntityTypeMap' => [
120-
\Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\ObjectWithCustomAttributes::class
121-
=> 'TestType'
122-
]
128+
'serviceTypeToEntityTypeMap' => $this->serviceTypeToEntityTypeMap
123129
]
124130
);
125131

@@ -386,6 +392,7 @@ public function testNestedArrayOfDataObjectProperties()
386392
public function testCustomAttributesProperties($customAttributeType, $inputData, $expectedObject)
387393
{
388394
$this->customAttributeTypeLocator->expects($this->any())->method('getType')->willReturn($customAttributeType);
395+
$this->serviceTypeToEntityTypeMap->expects($this->any())->method('getEntityType')->willReturn($expectedObject);
389396

390397
$result = $this->serviceInputProcessor->process(
391398
\Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService::class,

0 commit comments

Comments
 (0)