Tests/Services/SearchServiceTest.php
author ymh <ymh.work@gmail.com>
Wed, 14 Dec 2011 23:28:57 +0100
changeset 63 774ba82dca59
parent 57 186c4121c7b3
child 68 e7384fb35f7a
permissions -rwxr-xr-x
add tests and fixtures

<?php
/*
 * This file is part of the WikiTagBundle package.
 *
 * (c) IRI <http://www.iri.centrepompidou.fr/>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace IRI\Bundle\WikiTagBundle\Tests\Services;

require_once(__DIR__ . "/../../../../../../../app/AppKernel.php");

class SearchServiceTest extends \PHPUnit_Framework_TestCase
{

    protected $_container;
    
    public function __construct()
    {
        $kernel = new \AppKernel("test", true);
        $kernel->boot();
        $this->_container = $kernel->getContainer();
        parent::__construct();
    }
    
    protected function get($service)
    {
        return $this->_container->get($service);
    }
    
    
    public function testTagCloud()
    {
        
        $search_service = $this->get("wiki_tag.search");
        
        $result = $search_service->getTagCloud(30);
        
        $this->assertNotNull($result, "tag cloud should not be null");
        $this->assertLessThanOrEqual(30, count($result));
    }

    
    public function testCompletion()
    {
    
        $search_service = $this->get("wiki_tag.search");
    
        $result = $search_service->completion("tag");
    
        $this->assertNotNull($result, "tag cloud should not be null");
        $this->assertEquals(4, count($result));
    }
    
    
}