Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Nov 25, 2024
1 parent a94b7fe commit c6a5c6a
Showing 1 changed file with 136 additions and 0 deletions.
136 changes: 136 additions & 0 deletions tests/Fieldtypes/ArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,23 @@ public static function keyedProcessProvider()
'side' => 'fries',
],
],
'associative array options, associative array value, with nulls' => [
false,
[
'food' => 'Food',
'drink' => 'Drink',
'side' => 'Side',
],
[
'food' => 'burger',
'drink' => 'coke',
'side' => null,
],
[
'food' => 'burger',
'drink' => 'coke',
],
],
'associative array options, associative array value with expanded setting' => [
true,
[
Expand All @@ -447,6 +464,23 @@ public static function keyedProcessProvider()
['key' => 'side', 'value' => 'fries'],
],
],
'associative array options, associative array value with expanded setting, with nulls' => [
true,
[
'food' => 'Food',
'drink' => 'Drink',
'side' => 'Side',
],
[
'food' => 'burger',
'drink' => 'coke',
'side' => null,
],
[
['key' => 'food', 'value' => 'burger'],
['key' => 'drink', 'value' => 'coke'],
],
],
'multidimensional array options, associative array value' => [
false,
[
Expand All @@ -465,6 +499,23 @@ public static function keyedProcessProvider()
'side' => 'fries',
],
],
'multidimensional array options, associative array value, with nulls' => [
false,
[
['key' => 'food', 'value' => 'Food'],
['key' => 'drink', 'value' => 'Drink'],
['key' => 'side', 'value' => 'Side'],
],
[
'food' => 'burger',
'drink' => 'coke',
'side' => null,
],
[
'food' => 'burger',
'drink' => 'coke',
],
],
'multidimensional array options, associative array value with expanded setting' => [
true,
[
Expand All @@ -483,6 +534,23 @@ public static function keyedProcessProvider()
['key' => 'side', 'value' => 'fries'],
],
],
'multidimensional array options, associative array value with expanded setting, with nulls' => [
true,
[
['key' => 'food', 'value' => 'Food'],
['key' => 'drink', 'value' => 'Drink'],
['key' => 'side', 'value' => 'Side'],
],
[
'food' => 'burger',
'drink' => 'coke',
'side' => null,
],
[
['key' => 'food', 'value' => 'burger'],
['key' => 'drink', 'value' => 'coke'],
],
],
'multidimensional array with numbers' => [
false,
[
Expand All @@ -501,6 +569,23 @@ public static function keyedProcessProvider()
2 => 'more',
],
],
'multidimensional array with numbers, with nulls' => [
false,
[
['key' => 0, 'value' => 'Zero'],
['key' => 1, 'value' => 'One'],
['key' => 2, 'value' => 'Two'],
],
[
0 => 'none',
1 => null,
2 => 'more',
],
[
0 => 'none',
2 => 'more',
],
],
'multidimensional array with numbers with expanded setting' => [
true,
[
Expand All @@ -519,6 +604,23 @@ public static function keyedProcessProvider()
['key' => 2, 'value' => 'more'],
],
],
'multidimensional array with numbers with expanded setting, with nulls' => [
true,
[
['key' => 0, 'value' => 'Zero'],
['key' => 1, 'value' => 'One'],
['key' => 2, 'value' => 'Two'],
],
[
0 => 'none',
1 => null,
2 => 'more',
],
[
['key' => 0, 'value' => 'none'],
['key' => 2, 'value' => 'more'],
],
],
'multidimensional array with non-sequential numbers' => [
false,
[
Expand All @@ -537,6 +639,23 @@ public static function keyedProcessProvider()
0 => 'none',
],
],
'multidimensional array with non-sequential numbers, with nulls' => [
false,
[
['key' => 0, 'value' => 'Zero'],
['key' => 1, 'value' => 'One'],
['key' => 2, 'value' => 'Two'],
],
[
2 => 'some',
1 => null,
0 => 'none',
],
[
2 => 'some',
0 => 'none',
],
],
'multidimensional array with non-sequential numbers with expanded setting' => [
true,
[
Expand All @@ -555,6 +674,23 @@ public static function keyedProcessProvider()
['key' => 0, 'value' => 'none'],
],
],
'multidimensional array with non-sequential numbers with expanded setting, with nulls' => [
true,
[
['key' => 0, 'value' => 'Zero'],
['key' => 1, 'value' => 'One'],
['key' => 2, 'value' => 'Two'],
],
[
2 => 'some',
1 => null,
0 => 'none',
],
[
['key' => 2, 'value' => 'some'],
['key' => 0, 'value' => 'none'],
],
],
];
}

Expand Down

0 comments on commit c6a5c6a

Please sign in to comment.