function NestedArrayUnitTest::testMergeDeepArray

Tests NestedArray::mergeDeepArray().

File

drupal/core/tests/Drupal/Tests/Core/NestedArrayUnitTest.php, line 129
Contains \Drupal\Core\NestedArrayUnitTest.

Class

NestedArrayUnitTest
Tests the NestedArray helper class.

Namespace

Drupal\Tests\Core

Code

function testMergeDeepArray() {
  $link_options_1 = array(
    'fragment' => 'x',
    'attributes' => array(
      'title' => 'X',
      'class' => array(
        'a',
        'b',
      ),
    ),
    'language' => 'en',
  );
  $link_options_2 = array(
    'fragment' => 'y',
    'attributes' => array(
      'title' => 'Y',
      'class' => array(
        'c',
        'd',
      ),
    ),
    'html' => TRUE,
  );
  $expected = array(
    'fragment' => 'y',
    'attributes' => array(
      'title' => 'Y',
      'class' => array(
        'a',
        'b',
        'c',
        'd',
      ),
    ),
    'language' => 'en',
    'html' => TRUE,
  );
  $this
    ->assertSame(NestedArray::mergeDeepArray(array(
    $link_options_1,
    $link_options_2,
  )), $expected, 'NestedArray::mergeDeepArray() returned a properly merged array.');
}