$expected_list_items =
[ 0 =>
['hreflang' => 'en', 'data-drupal-link-system-path' => 'user/2'
],
1 =>
['hreflang' => 'fr', 'data-drupal-link-system-path' => 'user/2'
],
];
$this->
assertSame($expected_list_items,
$list_items, 'The list items have the correct attributes that will allow the drupal.active-link library to mark them as active.'
);
$expected_anchors =
[ 0 =>
['hreflang' => 'en', 'data-drupal-link-system-path' => 'user/2'
],
1 =>
['hreflang' => 'fr', 'data-drupal-link-system-path' => 'user/2'
],
];
$this->
assertSame($expected_anchors,
$anchors, 'The anchors have the correct attributes that will allow the drupal.active-link library to mark them as active.'
);
$settings =
$this->
getDrupalSettings();
$this->
assertSame('user/2',
$settings['path'
]['currentPath'
], 'drupalSettings.path.currentPath is set correctly to allow drupal.active-link to mark the correct links as active.'
);
$this->
assertFalse($settings['path'
]['isFront'
], 'drupalSettings.path.isFront is set correctly to allow drupal.active-link to mark the correct links as active.'
);
$this->
assertSame('en',
$settings['path'
]['currentLanguage'
], 'drupalSettings.path.currentLanguage is set correctly to allow drupal.active-link to mark the correct links as active.'
);
$this->
assertSame(['English', 'français'
],
$labels, 'The language links labels are in their own language on the language switcher block.'
);
} /**
* For anonymous users, the "active" class is set by PHP.
*
* @param string $block_label
* The label of the language switching block.
*
* @see self::testLanguageBlock()
*/