diff --git a/lib/internal/Magento/Framework/Reflection/Test/Unit/MethodsMapTest.php b/lib/internal/Magento/Framework/Reflection/Test/Unit/MethodsMapTest.php index 35af774c7ba45fba1b49f52cb2779602f2deb8fd..67a372c4d33ca754d7d35e9005730c55a55e4a19 100644 --- a/lib/internal/Magento/Framework/Reflection/Test/Unit/MethodsMapTest.php +++ b/lib/internal/Magento/Framework/Reflection/Test/Unit/MethodsMapTest.php @@ -86,44 +86,46 @@ class MethodsMapTest extends \PHPUnit_Framework_TestCase public function testGetMethodsMap() { + $data = [ + 'getMethodReturnType' => [ + 'type' => 'string', + 'isRequired' => true, + 'description' => null, + 'parameterCount' => 2, + ], + 'getMethodsMap' => [ + 'type' => 'array', + 'isRequired' => true, + 'description' => "<pre> Service methods' reflection data stored in cache as 'methodName' => " + . "'returnType' ex. [ 'create' => '\Magento\Customer\Api\Data\Customer', 'validatePassword' " + . "=> 'boolean' ] </pre>", + 'parameterCount' => 1, + ], + 'getMethodParams' => [ + 'type' => 'array', + 'isRequired' => true, + 'description' => null, + 'parameterCount' => 2 + ], + 'isMethodValidForDataField' => [ + 'type' => 'bool', + 'isRequired' => true, + 'description' => null, + 'parameterCount' => 2, + ], + 'isMethodReturnValueRequired' => [ + 'type' => 'bool', + 'isRequired' => true, + 'description' => null, + 'parameterCount' => 2, + ], + ]; $this->serializerMock->expects($this->once()) - ->method('serialize'); + ->method('serialize') + ->with($data); $methodsMap = $this->object->getMethodsMap(\Magento\Framework\Reflection\MethodsMap::class); $this->assertEquals( - [ - 'getMethodReturnType' => [ - 'type' => 'string', - 'isRequired' => true, - 'description' => null, - 'parameterCount' => 2, - ], - 'getMethodsMap' => [ - 'type' => 'array', - 'isRequired' => true, - 'description' => "<pre> Service methods' reflection data stored in cache as 'methodName' => " - . "'returnType' ex. [ 'create' => '\Magento\Customer\Api\Data\Customer', 'validatePassword' " - . "=> 'boolean' ] </pre>", - 'parameterCount' => 1, - ], - 'getMethodParams' => [ - 'type' => 'array', - 'isRequired' => true, - 'description' => null, - 'parameterCount' => 2 - ], - 'isMethodValidForDataField' => [ - 'type' => 'bool', - 'isRequired' => true, - 'description' => null, - 'parameterCount' => 2, - ], - 'isMethodReturnValueRequired' => [ - 'type' => 'bool', - 'isRequired' => true, - 'description' => null, - 'parameterCount' => 2, - ], - ], + $data, $methodsMap ); } diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php index 4892c96a220580d2a678c3ce69f3f75752bab8ef..658755d38a4e86ea8ffcc4e8333e30e4f6507658 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php @@ -100,13 +100,9 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase ); $serializerMock = $this->getMock(SerializerInterface::class); $serializerMock->method('serialize') - ->willReturnCallback(function ($data) { - return json_encode($data); - }); + ->willReturn('serializedData'); $serializerMock->method('unserialize') - ->willReturnCallback(function ($string) { - return json_decode($string, true); - }); + ->willReturn('unserializedData'); $objectManager->setBackwardCompatibleProperty( $this->methodsMap, 'serializer',