From c3cbfa740834ee76f8ff268239d9149be4e6e186 Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Wed, 24 Aug 2016 13:16:02 -0400
Subject: [PATCH] Expand tags test for case sensitivity.

---
 .../src/VuFindTest/Mink/RecordActionsTest.php | 44 +++++++++++++++++--
 1 file changed, 40 insertions(+), 4 deletions(-)

diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/RecordActionsTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/RecordActionsTest.php
index 0b9ce47baab..3488400d35e 100644
--- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/RecordActionsTest.php
+++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/RecordActionsTest.php
@@ -123,7 +123,7 @@ class RecordActionsTest extends \VuFindTest\Unit\MinkTestCase
         // Create new account
         $this->makeAccount($page, 'username1');
         // Make sure page updated for login
-        $page = $this->gotoRecord();
+        // $page = $this->gotoRecord();
         $this->findCss($page, '.record-tabs .usercomments')->click();
         $this->assertEquals(// Can Comment?
             'Add your comment',
@@ -145,7 +145,7 @@ class RecordActionsTest extends \VuFindTest\Unit\MinkTestCase
     }
 
     /**
-     * Test adding comments on records.
+     * Test adding tags on records.
      *
      * @return void
      */
@@ -173,7 +173,7 @@ class RecordActionsTest extends \VuFindTest\Unit\MinkTestCase
         $this->findCss($page, '.logoutOptions a.logout')->click();
         $this->snooze();
         // Login
-        $page = $this->gotoRecord(); // redirects to search home???
+        // $page = $this->gotoRecord();
         $this->findCss($page, '.tag-record')->click();
         $this->snooze();
         $this->fillInLoginForm($page, 'username2', 'test');
@@ -223,7 +223,7 @@ class RecordActionsTest extends \VuFindTest\Unit\MinkTestCase
         $this->fillInLoginForm($page, 'username1', 'test');
         $this->findCss($page, '.modal-body .btn.btn-primary')->click();
         $this->snooze();
-        $page = $this->gotoRecord();
+        // $page = $this->gotoRecord();
         // Check selected == 0
         $this->assertNull($page->find('css', '.tagList .tag.selected'));
         $this->findCss($page, '.tagList .tag');
@@ -241,6 +241,42 @@ class RecordActionsTest extends \VuFindTest\Unit\MinkTestCase
         $this->findCss($page, '.logoutOptions a.logout')->click();
     }
 
+    /**
+     * Test adding case sensitive tags on records.
+     *
+     * @return void
+     */
+    public function testAddSensitiveTag()
+    {
+        // Change the theme:
+        $this->changeConfigs(
+            [
+                'config' => [
+                    'Site' => ['theme' => 'bootstrap3'],
+                    'Social' => ['case_sensitive_tags' => 'true']
+                ]
+            ]
+        );
+        // Login
+        $page = $this->gotoRecord();
+        $this->findCss($page, '.tag-record')->click();
+        $this->snooze();
+        $this->fillInLoginForm($page, 'username2', 'test');
+        $this->submitLoginForm($page);
+        // Add tags
+        $this->findCss($page, '.modal #addtag_tag')->setValue('one ONE "new tag" ONE "THREE 4"');
+        $this->findCss($page, '.modal-body .btn.btn-primary')->click();
+        $this->snooze();
+        $success = $this->findCss($page, '.modal-body .alert-success');
+        $this->assertEquals('Tags Saved', $success->getText());
+        $this->findCss($page, '.modal .close')->click();
+        // Count tags
+        $this->snooze();
+        $page = $this->gotoRecord();
+        $tags = $page->findAll('css', '.tagList .tag');
+        $this->assertEquals(6, count($tags));
+    }
+
     /**
      * Test record view email.
      *
-- 
GitLab