From edf5345737880eab34527ab836fff9e0c11fe4bc Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Thu, 7 Apr 2016 12:27:23 -0400
Subject: [PATCH] Test language switching.

---
 .../src/VuFindTest/Mink/BasicTest.php         | 26 +++++++++++++++++++
 themes/bootstrap3/templates/header.phtml      |  4 +--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/BasicTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/BasicTest.php
index ae322204cbd..52f6cf83ca6 100644
--- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/BasicTest.php
+++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/BasicTest.php
@@ -79,4 +79,30 @@ class BasicTest extends \VuFindTest\Unit\MinkTestCase
             $this->findCss($page, '.location')->getText()
         );
     }
+
+    /**
+     * Test language switching by checking a link in the footer
+     *
+     * @return void
+     */
+    public function testLanguage()
+    {
+        $session = $this->getMinkSession();
+        $session->visit($this->getVuFindUrl() . '/Search/Home');
+        $page = $session->getPage();
+        // Check footer help-link
+        $this->assertEquals(
+            'Search Tips',
+            $this->findCss($page, 'footer .help-link')->getHTML()
+        );
+        // Change the language:
+        $this->findCss($page, '.language.dropdown')->click();
+        $this->findCss($page, '.language.dropdown li:not(.active) a')->click();
+        $this->snooze();
+        // Check footer help-link
+        $this->assertNotEquals(
+            'Search Tips',
+            $this->findCss($page, 'footer .help-link')->getHTML()
+        );
+    }
 }
diff --git a/themes/bootstrap3/templates/header.phtml b/themes/bootstrap3/templates/header.phtml
index 4dac97c846f..51e4b28db07 100644
--- a/themes/bootstrap3/templates/header.phtml
+++ b/themes/bootstrap3/templates/header.phtml
@@ -42,7 +42,7 @@
         <? endif; ?>
 
         <? if (isset($this->layout()->themeOptions) && count($this->layout()->themeOptions) > 1): ?>
-          <li class="dropdown">
+          <li class="theme dropdown">
             <form method="post" name="themeForm" id="themeForm">
               <input type="hidden" name="ui"/>
             </form>
@@ -56,7 +56,7 @@
         <? endif; ?>
 
         <? if (isset($this->layout()->allLangs) && count($this->layout()->allLangs) > 1): ?>
-          <li class="dropdown">
+          <li class="language dropdown">
             <form method="post" name="langForm" id="langForm">
               <input type="hidden" name="mylang"/>
             </form>
-- 
GitLab