| author | ymh <ymh.work@gmail.com> |
| Thu, 23 Feb 2012 23:02:07 +0100 | |
| changeset 75 | ca2a145e67f3 |
| parent 68 | e7384fb35f7a |
| permissions | -rwxr-xr-x |
| 34 | 1 |
<?php |
2 |
/* |
|
3 |
* This file is part of the WikiTagBundle package. |
|
4 |
* |
|
5 |
* (c) IRI <http://www.iri.centrepompidou.fr/> |
|
6 |
* |
|
7 |
* For the full copyright and license information, please view the LICENSE |
|
8 |
* file that was distributed with this source code. |
|
9 |
*/ |
|
10 |
||
11 |
namespace IRI\Bundle\WikiTagBundle\Tests\Services; |
|
12 |
||
13 |
require_once(__DIR__ . "/../../../../../../../app/AppKernel.php"); |
|
14 |
||
15 |
class SearchServiceTest extends \PHPUnit_Framework_TestCase |
|
16 |
{ |
|
17 |
||
18 |
protected $_container; |
|
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
19 |
protected $_application; |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
20 |
protected $_kernel; |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
21 |
|
| 34 | 22 |
|
23 |
public function __construct() |
|
24 |
{ |
|
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
25 |
$this->_kernel = new \AppKernel("test", true); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
26 |
$this->_kernel->boot(); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
27 |
$this->_container = $this->_kernel->getContainer(); |
| 34 | 28 |
parent::__construct(); |
29 |
} |
|
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
30 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
31 |
protected function runConsole($command, Array $options = array()) |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
32 |
{ |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
33 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
34 |
$options["-e"] = "test"; |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
35 |
$options["-q"] = null; |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
36 |
$options = array_merge($options, array('command' => $command)); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
37 |
return $this->_application->run(new \Symfony\Component\Console\Input\ArrayInput($options)); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
38 |
} |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
39 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
40 |
public function setUp() |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
41 |
{ |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
42 |
$this->_application = new \Symfony\Bundle\FrameworkBundle\Console\Application($this->_kernel); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
43 |
$this->_application->setAutoExit(false); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
44 |
$this->runConsole("doctrine:schema:drop", array("--force" => true)); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
45 |
$this->runConsole("wikitag:schema:create"); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
46 |
$this->runConsole("cache:warmup"); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
47 |
$this->runConsole("doctrine:fixtures:load"/*, array("--fixtures" => __DIR__ . "/../../../../../../../src/Company/BaseBundle/DataFixtures")*/); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
48 |
} |
| 34 | 49 |
|
50 |
protected function get($service) |
|
51 |
{ |
|
52 |
return $this->_container->get($service); |
|
53 |
} |
|
54 |
||
55 |
||
56 |
public function testTagCloud() |
|
57 |
{ |
|
58 |
$search_service = $this->get("wiki_tag.search"); |
|
59 |
||
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
60 |
$result = $search_service->getTagCloud(4); |
| 34 | 61 |
|
62 |
$this->assertNotNull($result, "tag cloud should not be null"); |
|
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
63 |
$this->assertLessThanOrEqual(4, count($result)); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
64 |
$this->assertEquals(4, count($result)); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
65 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
66 |
// 0->tag4,6 ; 0->tag3,5 ; 0->tag2,4 ; 0->tag1,2 |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
67 |
$expected = array('Tag1'=>2,'Tag2'=>4, 'Tag3'=>5, 'Tag4'=>6); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
68 |
for ($i = 0; $i < 4; $i++) { |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
69 |
$tagname = "Tag".(4-$i); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
70 |
$this->assertEquals($tagname,$result[$i]['label']); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
71 |
$this->assertEquals($expected[$tagname],$result[$i]['nb_docs']); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
72 |
} |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
73 |
|
| 34 | 74 |
} |
75 |
||
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
76 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
77 |
public function testTagCloudLimit() |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
78 |
{ |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
79 |
$search_service = $this->get("wiki_tag.search"); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
80 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
81 |
$result = $search_service->getTagCloud(2); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
82 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
83 |
$this->assertNotNull($result, "tag cloud should not be null"); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
84 |
$this->assertEquals(2, count($result)); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
85 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
86 |
$expected = array('Tag3'=>5, 'Tag4'=>6); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
87 |
for ($i = 0; $i < 2; $i++) { |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
88 |
$tagname = "Tag".(4-$i); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
89 |
$this->assertEquals($tagname,$result[$i]['label']); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
90 |
$this->assertEquals($expected[$tagname],$result[$i]['nb_docs']); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
91 |
} |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
92 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
93 |
} |
| 34 | 94 |
|
95 |
public function testCompletion() |
|
96 |
{ |
|
97 |
$search_service = $this->get("wiki_tag.search"); |
|
98 |
||
| 63 | 99 |
$result = $search_service->completion("tag"); |
|
75
ca2a145e67f3
Completion service add the nb of doc + test
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
100 |
$completion_result = array( |
|
ca2a145e67f3
Completion service add the nb of doc + test
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
101 |
'Tag1' => 2, |
|
ca2a145e67f3
Completion service add the nb of doc + test
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
102 |
'Tag2' => 4, |
|
ca2a145e67f3
Completion service add the nb of doc + test
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
103 |
'Tag3' => 5, |
|
ca2a145e67f3
Completion service add the nb of doc + test
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
104 |
'Tag4' => 6 |
|
ca2a145e67f3
Completion service add the nb of doc + test
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
105 |
); |
| 34 | 106 |
|
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
107 |
$this->assertNotNull($result, "completion should not be null"); |
| 63 | 108 |
$this->assertEquals(4, count($result)); |
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
109 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
110 |
foreach ($result as $tagname) { |
|
75
ca2a145e67f3
Completion service add the nb of doc + test
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
111 |
$this->assertEquals(0,strpos($tagname['label'],"Tag")); |
|
ca2a145e67f3
Completion service add the nb of doc + test
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
112 |
$this->assertArrayHasKey($tagname['label'], $completion_result); |
|
ca2a145e67f3
Completion service add the nb of doc + test
ymh <ymh.work@gmail.com>
parents:
68
diff
changeset
|
113 |
$this->assertEquals($completion_result[$tagname['label']], $tagname['nb_docs']); |
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
114 |
} |
| 34 | 115 |
} |
116 |
||
|
68
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
117 |
public function testSearch() { |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
118 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
119 |
$search_service = $this->get("wiki_tag.search"); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
120 |
$result = $search_service->search("Suspendisse"); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
121 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
122 |
$this->assertNotNull($result, "search result should not be null"); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
123 |
$this->assertEquals(1, count($result)); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
124 |
foreach (array("_score","host_doc_id", "wikitag_doc_id", "wikitag_doc", "title", "description", "categories") as $key) { |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
125 |
$this->assertArrayHasKey($key,$result[0]); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
126 |
$this->assertNotNull($result[0][$key]); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
127 |
} |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
128 |
$this->assertTrue($result[0]['_score']>0); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
129 |
$this->assertEquals("Lorem ipsum dolor sit amet", $result[0]['title']); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
130 |
$this->assertTrue(is_a($result[0]['wikitag_doc'], "\IRI\Bundle\WikiTagBundle\Model\DocumentInterface")); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
131 |
$this->assertEquals("Lorem ipsum dolor sit amet", $result[0]['wikitag_doc']->getTitle()); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
132 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
133 |
} |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
134 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
135 |
public function testSearchCondition() { |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
136 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
137 |
$search_service = $this->get("wiki_tag.search"); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
138 |
$result = $search_service->search("ullamcorper"); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
139 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
140 |
$this->assertNotNull($result, "search result should not be null"); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
141 |
$this->assertEquals(2, count($result)); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
142 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
143 |
$result = $search_service->search("ullamcorper", array("tagsStr"=>array("operator"=>"like","value"=>"barfoo"))); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
144 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
145 |
foreach (array("_score","host_doc_id", "wikitag_doc_id", "wikitag_doc", "title", "description", "categories") as $key) { |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
146 |
$this->assertArrayHasKey($key,$result[0]); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
147 |
$this->assertNotNull($result[0][$key]); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
148 |
} |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
149 |
$this->assertTrue($result[0]['_score']>0); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
150 |
$this->assertEquals("Lorem ipsum dolor sit amet", $result[0]['title']); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
151 |
$this->assertTrue(is_a($result[0]['wikitag_doc'], "\IRI\Bundle\WikiTagBundle\Model\DocumentInterface")); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
152 |
$this->assertEquals("Lorem ipsum dolor sit amet", $result[0]['wikitag_doc']->getTitle()); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
153 |
$this->assertEquals("Lorem ipsum ullamcorper", $result[0]['description']); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
154 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
155 |
} |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
156 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
157 |
public function testSearchWeight() { |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
158 |
$search_service = $this->get("wiki_tag.search"); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
159 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
160 |
$result = $search_service->search(array('title'=>array('weight'=>0.9, 'value'=>'caveat'), 'description'=>array('weight'=>0.1, 'value'=>'caveat'))); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
161 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
162 |
$this->assertNotNull($result, "search result should not be null"); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
163 |
$this->assertEquals(2, count($result)); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
164 |
$this->assertTrue($result[0]['_score']>$result[1]['_score']); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
165 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
166 |
$this->assertEquals('caveat', $result[0]['title']); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
167 |
$this->assertEquals('emptor', $result[0]['description']); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
168 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
169 |
$result = $search_service->search(array('title'=>array('weight'=>0.1, 'value'=>'caveat'), 'description'=>array('weight'=>0.9, 'value'=>'caveat'))); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
170 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
171 |
$this->assertNotNull($result, "search result should not be null"); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
172 |
$this->assertEquals(2, count($result)); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
173 |
$this->assertTrue($result[0]['_score']>$result[1]['_score']); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
174 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
175 |
$this->assertEquals('caveat', $result[0]['description']); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
176 |
$this->assertEquals('emptor', $result[0]['title']); |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
177 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
178 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
179 |
} |
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
180 |
|
|
e7384fb35f7a
improve search test and documentation
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
181 |
|
| 34 | 182 |
|
183 |
} |
|
184 |