Skip to content

Commit 33ee1b0

Browse files
committed
MAGETWO-66412: Remove usages of serialize/unserialize in Config Module
- Replace static serialize call with mocked string
1 parent 00efa0d commit 33ee1b0

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

app/code/Magento/Config/Test/Unit/App/Config/Type/SystemTest.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function testGet($isCached)
8888
{
8989
$path = 'default/dev/unsecure/url';
9090
$url = 'http://magento.test/';
91-
$data = [
91+
$unserializedData = [
9292
'default' => [
9393
'dev' => [
9494
'unsecure' => [
@@ -97,41 +97,42 @@ public function testGet($isCached)
9797
]
9898
]
9999
];
100+
$serializedDataString = '{"serialized-data"}';
100101

101102
$this->cache->expects($this->once())
102103
->method('load')
103104
->with(System::CONFIG_TYPE)
104-
->willReturn($isCached ? $data : null);
105+
->willReturn($isCached ? $unserializedData : null);
105106

106107
if ($isCached) {
107108
$this->serializer->expects($this->once())
108109
->method('unserialize')
109-
->willReturn($data);
110+
->willReturn($unserializedData);
110111
}
111112

112113
if (!$isCached) {
113114
$this->serializer->expects($this->once())
114115
->method('serialize')
115-
->willReturn(serialize($data));
116+
->willReturn($serializedDataString);
116117
$this->source->expects($this->once())
117118
->method('get')
118-
->willReturn($data);
119+
->willReturn($unserializedData);
119120
$this->fallback->expects($this->once())
120121
->method('process')
121-
->with($data)
122+
->with($unserializedData)
122123
->willReturnArgument(0);
123124
$this->preProcessor->expects($this->once())
124125
->method('process')
125-
->with($data)
126+
->with($unserializedData)
126127
->willReturnArgument(0);
127128
$this->postProcessor->expects($this->once())
128129
->method('process')
129-
->with($data)
130+
->with($unserializedData)
130131
->willReturnArgument(0);
131132
$this->cache->expects($this->once())
132133
->method('save')
133134
->with(
134-
serialize($data),
135+
$serializedDataString,
135136
System::CONFIG_TYPE,
136137
[System::CACHE_TAG]
137138
);

0 commit comments

Comments
 (0)