Added IndexManager test

This commit is contained in:
Leszek 2011-07-07 23:42:03 +02:00
parent 1c5f63d560
commit 3896ffd9ff
2 changed files with 43 additions and 1 deletions

View file

@ -0,0 +1,42 @@
<?php
namespace FOQ\ElasticaBundle\Tests\IndexManager;
use FOQ\ElasticaBundle\IndexManager;
class IndexManagerTest extends \PHPUnit_Framework_TestCase
{
/**
* @var FOQ\ElasticaBundle\Tests\IndexManager
*/
private $indexManager = null;
public function setUp()
{
$this->indexManager = new IndexManager(array('index1' => 'test1', 'index2' => 'test2'), 'defaultIndex');
}
public function testThatWeCanGetAllIndexes()
{
$this->assertEquals(array('index1' => 'test1', 'index2' => 'test2'), $this->indexManager->getAllIndexes());
}
/**
* @expectedException InvalidArgumentException
*/
public function testThatWeCannotGetIndexWhichWasNotSet()
{
$this->indexManager->getIndex('index8');
}
public function testThatWeCanGetDefaultIndex()
{
$this->assertEquals('defaultIndex', $this->indexManager->getIndex(false));
$this->assertEquals('defaultIndex', $this->indexManager->getDefaultIndex());
}
public function testThatWeCanGetIndex()
{
$this->assertEquals('test2', $this->indexManager->getIndex('index2'));
}
}

View file

@ -47,7 +47,7 @@ class ReseterTest extends \PHPUnit_Framework_TestCase
{
if (!class_exists('Elastica_Exception_Response') || !class_exists('Elastica_Response'))
{
$this->markTestSkipped('The Elastica library classes are not available');
$this->markTestSkipped('The Elastica library classes are not available');
}
}