8
8
9
9
use Magento \Framework \Serialize \SerializerInterface ;
10
10
use Magento \Framework \Webapi \ServiceInputProcessor ;
11
+ use Magento \Framework \Webapi \ServiceTypeToEntityTypeMap ;
11
12
use Magento \Framework \Webapi \Test \Unit \ServiceInputProcessor \WebapiBuilderFactory ;
12
13
use Magento \Framework \Webapi \Test \Unit \ServiceInputProcessor \AssociativeArray ;
13
14
use Magento \Framework \Webapi \Test \Unit \ServiceInputProcessor \DataArray ;
@@ -44,6 +45,11 @@ class ServiceInputProcessorTest extends \PHPUnit\Framework\TestCase
44
45
/** @var \PHPUnit_Framework_MockObject_MockObject */
45
46
protected $ fieldNamer ;
46
47
48
+ /**
49
+ * @var ServiceTypeToEntityTypeMap|\PHPUnit_Framework_MockObject_MockObject
50
+ */
51
+ private $ serviceTypeToEntityTypeMap ;
52
+
47
53
protected function setUp ()
48
54
{
49
55
$ objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
@@ -107,6 +113,9 @@ function () use ($objectManager) {
107
113
'serializer ' ,
108
114
$ serializerMock
109
115
);
116
+ $ this ->serviceTypeToEntityTypeMap = $ this ->getMockBuilder (ServiceTypeToEntityTypeMap::class)
117
+ ->disableOriginalConstructor ()
118
+ ->getMock ();
110
119
111
120
$ this ->serviceInputProcessor = $ objectManager ->getObject (
112
121
\Magento \Framework \Webapi \ServiceInputProcessor::class,
@@ -116,10 +125,7 @@ function () use ($objectManager) {
116
125
'customAttributeTypeLocator ' => $ this ->customAttributeTypeLocator ,
117
126
'attributeValueFactory ' => $ this ->attributeValueFactoryMock ,
118
127
'methodsMap ' => $ this ->methodsMap ,
119
- 'dataInterfaceToEntityTypeMap ' => [
120
- \Magento \Framework \Webapi \Test \Unit \ServiceInputProcessor \ObjectWithCustomAttributes::class
121
- => 'TestType '
122
- ]
128
+ 'serviceTypeToEntityTypeMap ' => $ this ->serviceTypeToEntityTypeMap
123
129
]
124
130
);
125
131
@@ -386,6 +392,7 @@ public function testNestedArrayOfDataObjectProperties()
386
392
public function testCustomAttributesProperties ($ customAttributeType , $ inputData , $ expectedObject )
387
393
{
388
394
$ this ->customAttributeTypeLocator ->expects ($ this ->any ())->method ('getType ' )->willReturn ($ customAttributeType );
395
+ $ this ->serviceTypeToEntityTypeMap ->expects ($ this ->any ())->method ('getEntityType ' )->willReturn ($ expectedObject );
389
396
390
397
$ result = $ this ->serviceInputProcessor ->process (
391
398
\Magento \Framework \Webapi \Test \Unit \ServiceInputProcessor \TestService::class,
0 commit comments