summaryrefslogtreecommitdiff
path: root/tests/units/FunctionTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units/FunctionTest.php')
-rw-r--r--tests/units/FunctionTest.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/units/FunctionTest.php b/tests/units/FunctionTest.php
index 1c5f971d..0709f1fb 100644
--- a/tests/units/FunctionTest.php
+++ b/tests/units/FunctionTest.php
@@ -59,6 +59,38 @@ class FunctionTest extends Base
$this->assertSame($expected, array_column_index($input, 'k1'));
}
+ public function testArrayColumnIndexUnique()
+ {
+ $input = array(
+ array(
+ 'k1' => 11,
+ 'k2' => 22,
+ ),
+ array(
+ 'k1' => 11,
+ 'k2' => 55,
+ ),
+ array(
+ 'k1' => 33,
+ 'k2' => 44,
+ ),
+ array()
+ );
+
+ $expected = array(
+ 11 => array(
+ 'k1' => 11,
+ 'k2' => 22,
+ ),
+ 33 => array(
+ 'k1' => 33,
+ 'k2' => 44,
+ )
+ );
+
+ $this->assertSame($expected, array_column_index_unique($input, 'k1'));
+ }
+
public function testArrayMergeRelation()
{
$relations = array(