Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit f7006d7

Browse files
Sergeymichalbundyra
authored andcommitted
added test for recursively set indentations
1 parent e8408c9 commit f7006d7

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

test/Generator/ValueGeneratorTest.php

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,87 @@ public function complexArray()
225225
return $this->generateArrayData($longOutput, $value);
226226
}
227227

228+
/**
229+
* Data provider for testPropertyDefaultValueCanHandleComplexArrayWCustomIndentOfTypes test
230+
*
231+
* @return array
232+
*/
233+
public function complexArrayWCustomIndent()
234+
{
235+
$value = [
236+
'5bcf08a0a5d20' => [
237+
'5bcf08a0a5d65' => [
238+
'5bcf08a0a5d9f' => [
239+
'5bcf08a0a5dd8' => [
240+
'5bcf08a0a5e11' => [
241+
'5bcf08a0a5e4f' => '5bcf08a0a5e8c',
242+
'5bcf08a0a5eca' => '5bcf08a0a5f05',
243+
'5bcf08a0a5f43' => '5bcf08a0a5f7f',
244+
'5bcf08a0a5fbd' => '5bcf08a0a5ff8',
245+
],
246+
],
247+
'5bcf08a0a603a' => [],
248+
'5bcf08a0a6062' => '5bcf08a0a609f',
249+
'5bcf08a0a60dc' => [
250+
'5bcf08a0a611b' => '5bcf08a0a6158',
251+
'5bcf08a0a6197' => [
252+
'5bcf08a0a61d7' => '5bcf08a0a6212',
253+
'5bcf08a0a6250' => '5bcf08a0a628c',
254+
'5bcf08a0a62cb' => '5bcf08a0a6306',
255+
],
256+
'5bcf08a0a6345' => [
257+
'5bcf08a0a637e' => '5bcf08a0a63b4',
258+
'5bcf08a0a63ee' => '5bcf08a0a642a',
259+
],
260+
'5bcf08a0a6449' => '5bcf08a0a6485',
261+
],
262+
],
263+
], '5bcf08a0a64c8' => '5bcf08a0a6540',
264+
'5bcf08a0a657f' => '5bcf08a0a65bf',
265+
],
266+
];
267+
268+
$longOutput = <<<EOS
269+
array(
270+
'5bcf08a0a5d20' => array(
271+
'5bcf08a0a5d65' => array(
272+
'5bcf08a0a5d9f' => array(
273+
'5bcf08a0a5dd8' => array(
274+
'5bcf08a0a5e11' => array(
275+
'5bcf08a0a5e4f' => '5bcf08a0a5e8c',
276+
'5bcf08a0a5eca' => '5bcf08a0a5f05',
277+
'5bcf08a0a5f43' => '5bcf08a0a5f7f',
278+
'5bcf08a0a5fbd' => '5bcf08a0a5ff8',
279+
),
280+
),
281+
'5bcf08a0a603a' => array(
282+
283+
),
284+
'5bcf08a0a6062' => '5bcf08a0a609f',
285+
'5bcf08a0a60dc' => array(
286+
'5bcf08a0a611b' => '5bcf08a0a6158',
287+
'5bcf08a0a6197' => array(
288+
'5bcf08a0a61d7' => '5bcf08a0a6212',
289+
'5bcf08a0a6250' => '5bcf08a0a628c',
290+
'5bcf08a0a62cb' => '5bcf08a0a6306',
291+
),
292+
'5bcf08a0a6345' => array(
293+
'5bcf08a0a637e' => '5bcf08a0a63b4',
294+
'5bcf08a0a63ee' => '5bcf08a0a642a',
295+
),
296+
'5bcf08a0a6449' => '5bcf08a0a6485',
297+
),
298+
),
299+
),
300+
'5bcf08a0a64c8' => '5bcf08a0a6540',
301+
'5bcf08a0a657f' => '5bcf08a0a65bf',
302+
),
303+
)
304+
EOS;
305+
306+
return $this->generateArrayData($longOutput, $value);
307+
}
308+
228309
/**
229310
* Data provider for testPropertyDefaultValueCanHandleArrayWithUnsortedKeys test
230311
*
@@ -338,6 +419,23 @@ public function testPropertyDefaultValueCanHandleComplexArrayOfTypes($type, arra
338419
self::assertEquals($expected, $valueGenerator->generate());
339420
}
340421

422+
/**
423+
* @dataProvider complexArrayWCustomIndent
424+
*
425+
* @param string $type
426+
* @param array $value
427+
* @param string $expected
428+
*/
429+
public function testPropertyDefaultValueCanHandleComplexArrayWCustomIndentOfTypes($type, array $value, $expected)
430+
{
431+
$valueGenerator = new ValueGenerator();
432+
$valueGenerator->setType($type);
433+
$valueGenerator->setValue($value);
434+
$valueGenerator->setIndentation("\t");
435+
436+
self::assertEquals($expected, $valueGenerator->generate());
437+
}
438+
341439
/**
342440
* @group 6023
343441
*

0 commit comments

Comments
 (0)