File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -101,4 +101,14 @@ public function unserialize($serialized)
101
101
{
102
102
$ this ->storage = unserialize ($ serialized );
103
103
}
104
+
105
+ public function __serialize ()
106
+ {
107
+ return [$ this ->serialize ()];
108
+ }
109
+
110
+ public function __unserialize (array $ data )
111
+ {
112
+ $ this ->unserialize ($ data [0 ]);
113
+ }
104
114
}
Original file line number Diff line number Diff line change @@ -151,14 +151,8 @@ public function testSerializable()
151
151
$ context ->add ('test_2 ' , 'bazzfoo ' );
152
152
$ context ->add ('test_3 ' , ['key ' => 'value ' ]);
153
153
154
- $ data = serialize ($ context );
155
-
156
- $ hash = sha1 ($ data );
157
- static ::assertEquals ('7d06bb0e2174031f1c16bf4f304978ad3d9664ed ' , $ hash );
158
-
159
154
/** @var Context $context2 */
160
- $ context2 = unserialize ($ data );
161
- static ::assertEquals ('foobar ' , $ context2 ->get ('test_1 ' ));
155
+ $ context2 = unserialize (serialize ($ context )); static ::assertEquals ('foobar ' , $ context2 ->get ('test_1 ' ));
162
156
static ::assertEquals ('bazzfoo ' , $ context2 ->get ('test_2 ' ));
163
157
static ::assertEquals (['key ' => 'value ' ], $ context2 ->get ('test_3 ' ));
164
158
}
You can’t perform that action at this time.
0 commit comments