public function testToArray() { $field = 'test'; $testQuery = 'Nicolas Ruflin'; $type = 'phrase'; $operator = 'and'; $analyzer = 'myanalyzer'; $boost = 2.0; $minimumShouldMatch = 2; $fuzziness = 0.3; $fuzzyRewrite = 'constant_score_boolean'; $prefixLength = 3; $maxExpansions = 12; $query = new Match(); $query->setFieldQuery($field, $testQuery); $query->setFieldType($field, $type); $query->setFieldOperator($field, $operator); $query->setFieldAnalyzer($field, $analyzer); $query->setFieldBoost($field, $boost); $query->setFieldMinimumShouldMatch($field, $minimumShouldMatch); $query->setFieldFuzziness($field, $fuzziness); $query->setFieldFuzzyRewrite($field, $fuzzyRewrite); $query->setFieldPrefixLength($field, $prefixLength); $query->setFieldMaxExpansions($field, $maxExpansions); $expectedArray = array('match' => array($field => array('query' => $testQuery, 'type' => $type, 'operator' => $operator, 'analyzer' => $analyzer, 'boost' => $boost, 'minimum_should_match' => $minimumShouldMatch, 'fuzziness' => $fuzziness, 'fuzzy_rewrite' => $fuzzyRewrite, 'prefix_length' => $prefixLength, 'max_expansions' => $maxExpansions))); $this->assertEquals($expectedArray, $query->toArray()); }