16 private $serializedConfig;
19 private $serializerMock;
24 $this->serializerMock = $this->createMock(Json::class);
25 $contextMock = $this->createMock(Context::class);
26 $eventManagerMock = $this->createMock(\
Magento\Framework\Event\ManagerInterface::class);
27 $contextMock->method(
'getEventDispatcher')
28 ->willReturn($eventManagerMock);
32 'serializer' => $this->serializerMock,
33 'context' => $contextMock,
47 $this->serializedConfig->setValue(
$value);
48 $this->serializerMock->expects($this->exactly($numCalls))
49 ->method(
'unserialize')
50 ->willReturn($unserializedValue);
51 $this->serializedConfig->afterLoad();
52 $this->assertEquals($expected, $this->serializedConfig->getValue());
84 $this->serializedConfig->setId(
'id');
85 $this->serializedConfig->setValue(
$value);
86 $this->serializerMock->expects($this->exactly($numCalls))
88 ->willReturn($serializedValue);
89 $this->serializedConfig->beforeSave();
90 $this->assertEquals($expected, $this->serializedConfig->getValue());
testAfterLoad($expected, $value, $numCalls, $unserializedValue=null)
testBeforeSave($expected, $value, $numCalls, $serializedValue=null)