comparison vendor/symfony/var-dumper/Tests/Cloner/VarClonerTest.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children 129ea1e6d783
comparison
equal deleted inserted replaced
11:bfffd8d7479a 12:7a779792577d
129 ) 129 )
130 130
131 [3] => Array 131 [3] => Array
132 ( 132 (
133 [\000+\000var] => val 133 [\000+\000var] => val
134 )
135
136 )
137
138 [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0
139 [key:Symfony\Component\VarDumper\Cloner\Data:private] => 0
140 [maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20
141 [maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1
142 [useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1
143 )
144
145 EOTXT;
146 $this->assertStringMatchesFormat($expected, print_r($clone, true));
147 }
148
149 public function testLimits()
150 {
151 // Level 0:
152 $data = array(
153 // Level 1:
154 array(
155 // Level 2:
156 array(
157 // Level 3:
158 'Level 3 Item 0',
159 'Level 3 Item 1',
160 'Level 3 Item 2',
161 'Level 3 Item 3',
162 ),
163 array(
164 'Level 3 Item 4',
165 'Level 3 Item 5',
166 'Level 3 Item 6',
167 ),
168 array(
169 'Level 3 Item 7',
170 ),
171 ),
172 array(
173 array(
174 'Level 3 Item 8',
175 ),
176 'Level 2 Item 0',
177 ),
178 array(
179 'Level 2 Item 1',
180 ),
181 'Level 1 Item 0',
182 array(
183 // Test setMaxString:
184 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
185 'SHORT',
186 ),
187 );
188
189 $cloner = new VarCloner();
190 $cloner->setMinDepth(2);
191 $cloner->setMaxItems(5);
192 $cloner->setMaxString(20);
193 $clone = $cloner->cloneVar($data);
194
195 $expected = <<<EOTXT
196 Symfony\Component\VarDumper\Cloner\Data Object
197 (
198 [data:Symfony\Component\VarDumper\Cloner\Data:private] => Array
199 (
200 [0] => Array
201 (
202 [0] => Array
203 (
204 [2] => 1
205 )
206
207 )
208
209 [1] => Array
210 (
211 [0] => Array
212 (
213 [2] => 2
214 )
215
216 [1] => Array
217 (
218 [2] => 3
219 )
220
221 [2] => Array
222 (
223 [2] => 4
224 )
225
226 [3] => Level 1 Item 0
227 [4] => Array
228 (
229 [2] => 5
230 )
231
232 )
233
234 [2] => Array
235 (
236 [0] => Array
237 (
238 [2] => 6
239 )
240
241 [1] => Array
242 (
243 [0] => 2
244 [2] => 7
245 )
246
247 [2] => Array
248 (
249 [0] => 1
250 [2] => 0
251 )
252
253 )
254
255 [3] => Array
256 (
257 [0] => Array
258 (
259 [0] => 1
260 [2] => 0
261 )
262
263 [1] => Level 2 Item 0
264 )
265
266 [4] => Array
267 (
268 [0] => Level 2 Item 1
269 )
270
271 [5] => Array
272 (
273 [0] => Symfony\Component\VarDumper\Cloner\Stub Object
274 (
275 [type] => 2
276 [class] => 2
277 [value] => ABCDEFGHIJKLMNOPQRST
278 [cut] => 6
279 [handle] => 0
280 [refCount] => 0
281 [position] => 0
282 [attr] => Array
283 (
284 )
285
286 )
287
288 [1] => SHORT
289 )
290
291 [6] => Array
292 (
293 [0] => Level 3 Item 0
294 [1] => Level 3 Item 1
295 [2] => Level 3 Item 2
296 [3] => Level 3 Item 3
297 )
298
299 [7] => Array
300 (
301 [0] => Level 3 Item 4
134 ) 302 )
135 303
136 ) 304 )
137 305
138 [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0 306 [position:Symfony\Component\VarDumper\Cloner\Data:private] => 0