You are here

function ArrayHelperTest::testMapKeys in Helper 7

File

tests/ArrayHelperTest.test, line 45

Class

ArrayHelperTest

Code

function testMapKeys() {
  $input = array(
    'a' => 1,
    'b' => '1',
    'c' => 1,
    0 => '2',
    1 => 2,
  );
  $expected = array(
    '#a' => 1,
    '#b' => '1',
    '#c' => 1,
    '#0' => '2',
    '#1' => 2,
  );
  $result = ArrayHelper::mapKeys(function ($value) {
    return '#' . $value;
  }, $input);
  $this
    ->assertIdentical($result, $expected);
}