[7588] | 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_MoreLikeThisTest extends Solarium_Query_SelectTest |
---|
| 33 | { |
---|
| 34 | |
---|
| 35 | protected $_query; |
---|
| 36 | |
---|
| 37 | public function setUp() |
---|
| 38 | { |
---|
| 39 | $this->_query = new Solarium_Query_MoreLikeThis; |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | public function testGetType() |
---|
| 43 | { |
---|
| 44 | $this->assertEquals(Solarium_Client::QUERYTYPE_MORELIKETHIS, $this->_query->getType()); |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | public function testSetAndGetMatchInclude() |
---|
| 48 | { |
---|
| 49 | $value = true; |
---|
| 50 | $this->_query->setMatchInclude($value); |
---|
| 51 | |
---|
| 52 | $this->assertEquals( |
---|
| 53 | $value, |
---|
| 54 | $this->_query->getMatchInclude() |
---|
| 55 | ); |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | public function testSetAndGetMltFields() |
---|
| 59 | { |
---|
| 60 | $value = 'name,description'; |
---|
| 61 | $this->_query->setMltFields($value); |
---|
| 62 | |
---|
| 63 | $this->assertEquals( |
---|
| 64 | $value, |
---|
| 65 | $this->_query->getMltFields() |
---|
| 66 | ); |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | public function testSetAndGetInterestingTerms() |
---|
| 70 | { |
---|
| 71 | $value = 'test'; |
---|
| 72 | $this->_query->setInterestingTerms($value); |
---|
| 73 | |
---|
| 74 | $this->assertEquals( |
---|
| 75 | $value, |
---|
| 76 | $this->_query->getInterestingTerms() |
---|
| 77 | ); |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | public function testSetAndGetQueryStream() |
---|
| 81 | { |
---|
| 82 | $value = true; |
---|
| 83 | $this->_query->setQueryStream($value); |
---|
| 84 | |
---|
| 85 | $this->assertEquals( |
---|
| 86 | $value, |
---|
| 87 | $this->_query->getQueryStream() |
---|
| 88 | ); |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | public function testSetAndGetMinimumTermFrequency() |
---|
| 92 | { |
---|
| 93 | $value = 2; |
---|
| 94 | $this->_query->setMinimumTermFrequency($value); |
---|
| 95 | |
---|
| 96 | $this->assertEquals( |
---|
| 97 | $value, |
---|
| 98 | $this->_query->getMinimumTermFrequency() |
---|
| 99 | ); |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | public function testMinimumDocumentFrequency() |
---|
| 103 | { |
---|
| 104 | $value = 4; |
---|
| 105 | $this->_query->setMinimumDocumentFrequency($value); |
---|
| 106 | |
---|
| 107 | $this->assertEquals( |
---|
| 108 | $value, |
---|
| 109 | $this->_query->getMinimumDocumentFrequency() |
---|
| 110 | ); |
---|
| 111 | } |
---|
| 112 | |
---|
| 113 | public function testSetAndGetMinimumWordLength() |
---|
| 114 | { |
---|
| 115 | $value = 3; |
---|
| 116 | $this->_query->setMinimumWordLength($value); |
---|
| 117 | |
---|
| 118 | $this->assertEquals( |
---|
| 119 | $value, |
---|
| 120 | $this->_query->getMinimumWordLength() |
---|
| 121 | ); |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | public function testSetAndGetMaximumWordLength() |
---|
| 125 | { |
---|
| 126 | $value = 15; |
---|
| 127 | $this->_query->setMaximumWordLength($value); |
---|
| 128 | |
---|
| 129 | $this->assertEquals( |
---|
| 130 | $value, |
---|
| 131 | $this->_query->getMaximumWordLength() |
---|
| 132 | ); |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | public function testSetAndGetMaximumQueryTerms() |
---|
| 136 | { |
---|
| 137 | $value = 5; |
---|
| 138 | $this->_query->setMaximumQueryTerms($value); |
---|
| 139 | |
---|
| 140 | $this->assertEquals( |
---|
| 141 | $value, |
---|
| 142 | $this->_query->getMaximumQueryTerms() |
---|
| 143 | ); |
---|
| 144 | } |
---|
| 145 | |
---|
| 146 | public function testSetAndGetMaximumNumberOfTokens() |
---|
| 147 | { |
---|
| 148 | $value = 5; |
---|
| 149 | $this->_query->setMaximumNumberOfTokens($value); |
---|
| 150 | |
---|
| 151 | $this->assertEquals( |
---|
| 152 | $value, |
---|
| 153 | $this->_query->getMaximumNumberOfTokens() |
---|
| 154 | ); |
---|
| 155 | } |
---|
| 156 | |
---|
| 157 | public function testSetAndGetBoost() |
---|
| 158 | { |
---|
| 159 | $value = true; |
---|
| 160 | $this->_query->setBoost($value); |
---|
| 161 | |
---|
| 162 | $this->assertEquals( |
---|
| 163 | $value, |
---|
| 164 | $this->_query->getBoost() |
---|
| 165 | ); |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | public function testSetAndGetQueryFields() |
---|
| 169 | { |
---|
| 170 | $value = 'content,name'; |
---|
| 171 | $this->_query->setQueryFields($value); |
---|
| 172 | |
---|
| 173 | $this->assertEquals( |
---|
| 174 | $value, |
---|
| 175 | $this->_query->getQueryFields() |
---|
| 176 | ); |
---|
| 177 | } |
---|
| 178 | |
---|
| 179 | |
---|
| 180 | } |
---|