.../ActiveLinkResponseFilterTest.php | 43 ++++++++++++++--------
1 file changed, 27 insertions(+), 16 deletions(-)
diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php
index 82b3c2e..f9e3ead 100644
--- a/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php
+++ b/core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php
@@ -283,7 +283,7 @@ public function providerTestSetLinkActiveClass() {
$target_markup = $create_markup(new Attribute($active_attributes));
}
- $data[] = array($source_markup, $situation['context'], $target_markup);
+ $data[] = array($source_markup, $situation['context']['path'], $situation['context']['front'], $situation['context']['language'], $situation['context']['query'], $target_markup);
}
}
}
@@ -293,8 +293,11 @@ public function providerTestSetLinkActiveClass() {
// times.
$data[] = [
0 => 'Once Twice',
- 1 => ['path' => '', 'front' => TRUE, 'language' => 'en', 'query' => []],
- 2 => 'Once Twice',
+ 1 => '',
+ 2 => TRUE,
+ 3 => 'en',
+ 4 => [],
+ 5 => 'Once Twice',
];
// Test cases to verify that the 'is-active' class is added when on the
@@ -308,13 +311,19 @@ public function providerTestSetLinkActiveClass() {
$front_path_link_active = 'Front Path';
$data[] = [
0 => $front_path_link . ' ' . $front_special_link,
- 1 => ['path' => 'myfrontpage', 'front' => TRUE, 'language' => 'en', 'query' => []],
- 2 => $front_path_link_active . ' ' . $front_special_link_active,
+ 1 => 'myfrontpage',
+ 2 => TRUE,
+ 3 => 'en',
+ 4 => [],
+ 5 => $front_path_link_active . ' ' . $front_special_link_active,
];
$data[] = [
0 => $front_special_link . ' ' . $front_path_link,
- 1 => ['path' => 'myfrontpage', 'front' => TRUE, 'language' => 'en', 'query' => []],
- 2 => $front_special_link_active . ' ' . $front_path_link_active,
+ 1 => 'myfrontpage',
+ 2 => TRUE,
+ 3 => 'en',
+ 4 => [],
+ 5 => $front_special_link_active . ' ' . $front_path_link_active,
];
return $data;
@@ -325,21 +334,23 @@ public function providerTestSetLinkActiveClass() {
*
* @param string $html_markup
* The original HTML markup.
- * @param array $context
- * The page context to simulate. An array with the following keys:
- * - path: the system path of the currently active page
- * - front: whether the current page is the front page (which implies the
- * current path might also be )
- * - language: the language code of the currently active page
- * - query: the query string for the currently active page
+ * @param string $current_path
+ * The system path of the currently active page.
+ * @param bool $is_front
+ * Whether the current page is the front page (which implies the current
+ * path might also be ).
+ * @param string $url_language
+ * The language code of the current URL.
+ * @param array $query
+ * The query string for the current URL.
* @param string $expected_html_markup
* The expected updated HTML markup.
*
* @dataProvider providerTestSetLinkActiveClass
* @covers ::setLinkActiveClass
*/
- public function testSetLinkActiveClass($html_markup, array $context, $expected_html_markup) {
- $this->assertSame($expected_html_markup, ActiveLinkResponseFilter::setLinkActiveClass($html_markup, $context['path'], $context['front'], $context['language'], $context['query']));
+ public function testSetLinkActiveClass($html_markup, $current_path, $is_front, $url_language, array $query, $expected_html_markup) {
+ $this->assertSame($expected_html_markup, ActiveLinkResponseFilter::setLinkActiveClass($html_markup, $current_path, $is_front, $url_language, $query));
}
}