Added IndexManager test
This commit is contained in:
parent
1c5f63d560
commit
3896ffd9ff
42
Tests/IndexManagerTest.php
Normal file
42
Tests/IndexManagerTest.php
Normal 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'));
|
||||
}
|
||||
}
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue