From 3896ffd9ffdac55e438ec67b9f52fff60889af75 Mon Sep 17 00:00:00 2001 From: Leszek Date: Thu, 7 Jul 2011 23:42:03 +0200 Subject: [PATCH] Added IndexManager test --- Tests/IndexManagerTest.php | 42 ++++++++++++++++++++++++++++++++++++++ Tests/ReseterTest.php | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 Tests/IndexManagerTest.php diff --git a/Tests/IndexManagerTest.php b/Tests/IndexManagerTest.php new file mode 100644 index 0000000..897c3bb --- /dev/null +++ b/Tests/IndexManagerTest.php @@ -0,0 +1,42 @@ +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')); + } +} diff --git a/Tests/ReseterTest.php b/Tests/ReseterTest.php index 20f9370..233acea 100644 --- a/Tests/ReseterTest.php +++ b/Tests/ReseterTest.php @@ -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'); } }