|
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; |
|
|
19 |
|
|
|
20 |
public function __construct() |
|
|
21 |
{ |
|
|
22 |
$kernel = new \AppKernel("test", true); |
|
|
23 |
$kernel->boot(); |
|
|
24 |
$this->_container = $kernel->getContainer(); |
|
|
25 |
parent::__construct(); |
|
|
26 |
} |
|
|
27 |
|
|
|
28 |
protected function get($service) |
|
|
29 |
{ |
|
|
30 |
return $this->_container->get($service); |
|
|
31 |
} |
|
|
32 |
|
|
|
33 |
|
|
|
34 |
public function testTagCloud() |
|
|
35 |
{ |
|
|
36 |
|
|
|
37 |
$search_service = $this->get("wiki_tag.search"); |
|
|
38 |
|
|
|
39 |
$result = $search_service->getTagCloud(30); |
|
|
40 |
|
|
|
41 |
$this->assertNotNull($result, "tag cloud should not be null"); |
|
|
42 |
$this->assertLessThanOrEqual(30, count($result)); |
|
|
43 |
} |
|
|
44 |
|
|
|
45 |
|
|
|
46 |
public function testCompletion() |
|
|
47 |
{ |
|
|
48 |
|
|
|
49 |
$search_service = $this->get("wiki_tag.search"); |
|
|
50 |
|
|
|
51 |
$result = $search_service->completion("fra"); |
|
|
52 |
|
|
|
53 |
$this->assertNotNull($result, "tag cloud should not be null"); |
|
|
54 |
$this->assertGreaterThanOrEqual(1, count($result)); |
|
|
55 |
} |
|
|
56 |
|
|
|
57 |
|
|
|
58 |
} |
|
|
59 |
|