From a13fa738c4539f62131dcb812760390a2218cbf2 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Tue, 25 Mar 2014 15:34:51 -0400
Subject: [PATCH] More coverage improvements.

---
 module/VuFind/tests/fixtures/spell/query2     | Bin 0 -> 142 bytes
 module/VuFind/tests/fixtures/spell/spell2     | Bin 0 -> 563 bytes
 .../Search/Solr/SpellingProcessorTest.php     |  33 ++++++++++++++++++
 3 files changed, 33 insertions(+)
 create mode 100644 module/VuFind/tests/fixtures/spell/query2
 create mode 100644 module/VuFind/tests/fixtures/spell/spell2

diff --git a/module/VuFind/tests/fixtures/spell/query2 b/module/VuFind/tests/fixtures/spell/query2
new file mode 100644
index 0000000000000000000000000000000000000000..39c655f3dfe01685bd2e33f35e715e6c1efe348a
GIT binary patch
literal 142
zcmeabGBUAJ3M+NX%u5MQO)N^zhzTrBEvkf&N>;{J)x}nZrdCP}S`39C36I3Ql$_Ke
zCF^1<ODiSEoE*2z)SQ%J5Z@4J5=>ceNl|8AI#|@qN~xeIH8D3SCsiT6C^HF2gT)QO
Ss`Cp{ixNxnfd=|n*8%{(SuG&|

literal 0
HcmV?d00001

diff --git a/module/VuFind/tests/fixtures/spell/spell2 b/module/VuFind/tests/fixtures/spell/spell2
new file mode 100644
index 0000000000000000000000000000000000000000..3e64b98e42573bd357225fdfc4658d9719bc8163
GIT binary patch
literal 563
zcmcJLF;BxV5QY0wkVmGt&;pkUkTS4DA`(*;$GN1YiJhJuK^5h{b1p5FU@cxOouA+P
z?&YvbK)j8av2}rp^rn1LdW*I$3)fNkihgj`WBKBpEsFuWPH#|e1>C^o;U2`|dJ&L%
zFVbg_62v2s+UM0f>L6e#?_l}_14*ht#vgJGVjxs~)!|i3rs7-h<LYQ<$3AnTtwm};
zrmSa69~6bWX*`BFPI&wPf*H><x#l6$I5KTUxI5`2Z|BFhMIVf_F^DO?ah5Uh7Q}}m
zPWwg1fksENgQPh+%5>(F_MjkvX`W97>_(*hACI5y*n4>>%A<C+R#BV(ck$=mBkDz%
JE3ST?zW^!2wEF-6

literal 0
HcmV?d00001

diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/SpellingProcessorTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/SpellingProcessorTest.php
index 709e8d84a8a..7b0437516a5 100644
--- a/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/SpellingProcessorTest.php
+++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Search/Solr/SpellingProcessorTest.php
@@ -241,6 +241,39 @@ class SpellingProcessorTest extends TestCase
         );
     }
 
+    /**
+     * Test a shingle suggestion.
+     *
+     * @return void
+     */
+    public function testShingleSuggestion()
+    {
+        $spelling = $this->getFixture('spell2');
+        $query = $this->getFixture('query2');
+        $params = $this->getServiceManager()->get('VuFind\SearchParamsPluginManager')
+            ->get('Solr');
+        $params->setBasicSearch($query->getString(), $query->getHandler());
+        $sp = new SpellingProcessor();
+        $suggestions = $sp->getSuggestions($spelling, $query);
+        $this->assertEquals(
+            array(
+                'preamble gribble' => array(
+                    'freq' => 0,
+                    'suggestions' => array(
+                        'preamble article' => array(
+                            'freq' => 1,
+                            'new_term' => 'preamble article',
+                            'expand_term' => '((preamble gribble) OR (preamble article))',
+                        ),
+                    ),
+                ),
+            ),
+            $sp->processSuggestions(
+                $suggestions, $spelling->getQuery(), $params
+            )
+        );
+    }
+
     /**
      * Test that spelling tokenization works correctly.
      *
-- 
GitLab