Пример #1
0
 public function testBuildComponent()
 {
     $builder = new RequestBuilder();
     $request = new Request();
     $component = new Component();
     $component->setQuery('testquery');
     $component->setBuild(false);
     $component->setReload(true);
     $component->setDictionary('testdict');
     $component->setCount(3);
     $component->setOnlyMorePopular(false);
     $component->setExtendedResults(true);
     $component->setCollate(true);
     $component->setMaxCollations(2);
     $component->setMaxCollationTries(4);
     $component->setMaxCollationEvaluations(4);
     $component->setCollateExtendedResults(true);
     $component->setAccuracy(0.2);
     $component->setCollateParam('mm', '100%');
     $request = $builder->buildComponent($component, $request);
     $this->assertEquals(array('spellcheck' => 'true', 'spellcheck.q' => 'testquery', 'spellcheck.build' => 'false', 'spellcheck.reload' => 'true', 'spellcheck.dictionary' => 'testdict', 'spellcheck.count' => 3, 'spellcheck.onlyMorePopular' => 'false', 'spellcheck.extendedResults' => 'true', 'spellcheck.collate' => 'true', 'spellcheck.maxCollations' => 2, 'spellcheck.maxCollationTries' => 4, 'spellcheck.maxCollationEvaluations' => 4, 'spellcheck.collateExtendedResults' => 'true', 'spellcheck.accuracy' => 0.2, 'spellcheck.collateParam.mm' => '100%'), $request->getParams());
 }
Пример #2
0
 public function testSetAndGetMaxCollations()
 {
     $value = 23;
     $this->spellCheck->setMaxCollations($value);
     $this->assertEquals($value, $this->spellCheck->getMaxCollations());
 }