1 | <?php |
---|
2 | /** |
---|
3 | * Copyright 2011 Bas de Nooijer. All rights reserved. |
---|
4 | * |
---|
5 | * Redistribution and use in source and binary forms, with or without |
---|
6 | * modification, are permitted provided that the following conditions are met: |
---|
7 | * |
---|
8 | * 1. Redistributions of source code must retain the above copyright notice, |
---|
9 | * this list of conditions and the following disclaimer. |
---|
10 | * |
---|
11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
---|
12 | * this listof conditions and the following disclaimer in the documentation |
---|
13 | * and/or other materials provided with the distribution. |
---|
14 | * |
---|
15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" |
---|
16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
---|
19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
25 | * POSSIBILITY OF SUCH DAMAGE. |
---|
26 | * |
---|
27 | * The views and conclusions contained in the software and documentation are |
---|
28 | * those of the authors and should not be interpreted as representing official |
---|
29 | * policies, either expressed or implied, of the copyright holder. |
---|
30 | */ |
---|
31 | |
---|
32 | class Solarium_Query_Select_Component_SpellcheckTest extends PHPUnit_Framework_TestCase |
---|
33 | { |
---|
34 | |
---|
35 | /** |
---|
36 | * @var Solarium_Query_Select_Component_Spellcheck |
---|
37 | */ |
---|
38 | protected $_spellCheck; |
---|
39 | |
---|
40 | public function setUp() |
---|
41 | { |
---|
42 | $this->_spellCheck = new Solarium_Query_Select_Component_Spellcheck; |
---|
43 | } |
---|
44 | |
---|
45 | public function testGetType() |
---|
46 | { |
---|
47 | $this->assertEquals(Solarium_Query_Select::COMPONENT_SPELLCHECK, $this->_spellCheck->getType()); |
---|
48 | } |
---|
49 | |
---|
50 | public function testSetAndGetQuery() |
---|
51 | { |
---|
52 | $value = 'testquery'; |
---|
53 | $this->_spellCheck->setQuery($value); |
---|
54 | |
---|
55 | $this->assertEquals( |
---|
56 | $value, |
---|
57 | $this->_spellCheck->getQuery() |
---|
58 | ); |
---|
59 | } |
---|
60 | |
---|
61 | public function testSetAndGetBuild() |
---|
62 | { |
---|
63 | $value = true; |
---|
64 | $this->_spellCheck->setBuild($value); |
---|
65 | |
---|
66 | $this->assertEquals( |
---|
67 | $value, |
---|
68 | $this->_spellCheck->getBuild() |
---|
69 | ); |
---|
70 | } |
---|
71 | |
---|
72 | public function testSetAndGetReload() |
---|
73 | { |
---|
74 | $value = false; |
---|
75 | $this->_spellCheck->setReload($value); |
---|
76 | |
---|
77 | $this->assertEquals( |
---|
78 | $value, |
---|
79 | $this->_spellCheck->getReload() |
---|
80 | ); |
---|
81 | } |
---|
82 | |
---|
83 | public function testSetAndGetDictionary() |
---|
84 | { |
---|
85 | $value = 'myDictionary'; |
---|
86 | $this->_spellCheck->setDictionary($value); |
---|
87 | |
---|
88 | $this->assertEquals( |
---|
89 | $value, |
---|
90 | $this->_spellCheck->getDictionary() |
---|
91 | ); |
---|
92 | } |
---|
93 | |
---|
94 | public function testSetAndGetCount() |
---|
95 | { |
---|
96 | $value = 11; |
---|
97 | $this->_spellCheck->setCount($value); |
---|
98 | |
---|
99 | $this->assertEquals( |
---|
100 | $value, |
---|
101 | $this->_spellCheck->getCount() |
---|
102 | ); |
---|
103 | } |
---|
104 | |
---|
105 | public function testSetAndGetOnlyMorePopular() |
---|
106 | { |
---|
107 | $value = false; |
---|
108 | $this->_spellCheck->setOnlyMorePopular($value); |
---|
109 | |
---|
110 | $this->assertEquals( |
---|
111 | $value, |
---|
112 | $this->_spellCheck->getOnlyMorePopular() |
---|
113 | ); |
---|
114 | } |
---|
115 | |
---|
116 | public function testSetAndGetExtendedResults() |
---|
117 | { |
---|
118 | $value = false; |
---|
119 | $this->_spellCheck->setExtendedResults($value); |
---|
120 | |
---|
121 | $this->assertEquals( |
---|
122 | $value, |
---|
123 | $this->_spellCheck->getExtendedResults() |
---|
124 | ); |
---|
125 | } |
---|
126 | |
---|
127 | public function testSetAndGetCollate() |
---|
128 | { |
---|
129 | $value = false; |
---|
130 | $this->_spellCheck->setCollate($value); |
---|
131 | |
---|
132 | $this->assertEquals( |
---|
133 | $value, |
---|
134 | $this->_spellCheck->getCollate() |
---|
135 | ); |
---|
136 | } |
---|
137 | |
---|
138 | public function testSetAndGetMaxCollations() |
---|
139 | { |
---|
140 | $value = 23; |
---|
141 | $this->_spellCheck->setMaxCollations($value); |
---|
142 | |
---|
143 | $this->assertEquals( |
---|
144 | $value, |
---|
145 | $this->_spellCheck->getMaxCollations() |
---|
146 | ); |
---|
147 | } |
---|
148 | |
---|
149 | public function testSetAndGetMaxCollationTries() |
---|
150 | { |
---|
151 | $value = 10; |
---|
152 | $this->_spellCheck->setMaxCollationTries($value); |
---|
153 | |
---|
154 | $this->assertEquals( |
---|
155 | $value, |
---|
156 | $this->_spellCheck->getMaxCollationTries() |
---|
157 | ); |
---|
158 | } |
---|
159 | |
---|
160 | public function testSetAndGetMaxCollationEvaluations() |
---|
161 | { |
---|
162 | $value = 10; |
---|
163 | $this->_spellCheck->setMaxCollationEvaluations($value); |
---|
164 | |
---|
165 | $this->assertEquals( |
---|
166 | $value, |
---|
167 | $this->_spellCheck->getMaxCollationEvaluations() |
---|
168 | ); |
---|
169 | } |
---|
170 | |
---|
171 | public function testSetAndGetCollateExtendedResults() |
---|
172 | { |
---|
173 | $value = true; |
---|
174 | $this->_spellCheck->setCollateExtendedResults($value); |
---|
175 | |
---|
176 | $this->assertEquals( |
---|
177 | $value, |
---|
178 | $this->_spellCheck->getCollateExtendedResults() |
---|
179 | ); |
---|
180 | } |
---|
181 | |
---|
182 | public function testSetAndGetAccuracy() |
---|
183 | { |
---|
184 | $value = .1; |
---|
185 | $this->_spellCheck->setAccuracy($value); |
---|
186 | |
---|
187 | $this->assertEquals( |
---|
188 | $value, |
---|
189 | $this->_spellCheck->getAccuracy() |
---|
190 | ); |
---|
191 | } |
---|
192 | } |
---|