23 private $webapiCacheMock;
28 private $configReaderMock;
33 private $serializerMock;
37 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
39 $this->webapiCacheMock = $this->createMock(\
Magento\
Webapi\Model\Cache\Type\Webapi::class);
41 $this->serializerMock = $this->createMock(SerializerInterface::class);
46 'cache' => $this->webapiCacheMock,
47 'configReader' => $this->configReaderMock,
48 'serializer' => $this->serializerMock
55 $data = [
'foo' =>
'bar'];
56 $serializedData =
'serialized data';
57 $this->webapiCacheMock->expects($this->once())
60 ->willReturn($serializedData);
61 $this->serializerMock->expects($this->once())
62 ->method(
'unserialize')
63 ->with($serializedData)
65 $this->config->getServices();
66 $this->assertEquals(
$data, $this->config->getServices());
71 $data = [
'foo' =>
'bar'];
72 $serializedData =
'serialized data';
73 $this->webapiCacheMock->expects($this->once())
77 $this->serializerMock->expects($this->never())
78 ->method(
'unserialize');
79 $this->configReaderMock->expects($this->once())
82 $this->serializerMock->expects($this->once())
85 ->willReturn($serializedData);
86 $this->webapiCacheMock->expects($this->once())
93 $this->config->getServices();
94 $this->assertEquals(
$data, $this->config->getServices());