37 $this->serializer = $this->createMock(\
Magento\Framework\Serialize\Serializer\Json::class);
38 $this->normalizer = $this->createMock(Normalizer::class);
40 \
Magento\Widget\Helper\Conditions::class,
42 'serializer' => $this->serializer,
43 'normalizer' => $this->normalizer
51 $serializedValue =
'serializedString';
52 $normalizedValue =
'normalizedValue';
53 $this->serializer->expects($this->once())
56 ->willReturn($serializedValue);
57 $this->serializer->expects($this->once())
58 ->method(
'unserialize')
59 ->with($serializedValue)
61 $this->normalizer->expects($this->once())
62 ->method(
'replaceReservedCharacters')
63 ->with($serializedValue)
64 ->willReturn($normalizedValue);
65 $this->normalizer->expects($this->once())
66 ->method(
'restoreReservedCharacters')
67 ->with($normalizedValue)
68 ->willReturn($serializedValue);
69 $encoded = $this->conditions->encode(
$value);
70 $this->assertEquals(
$value, $this->conditions->decode($encoded));