From a27c82b0b3a12cd5a5516b576581b754bb53632e Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Mon, 29 Oct 2012 19:07:55 +0100 Subject: [PATCH] [SearchEngine] Add SearchEngine admin panel tests --- .../Controller/Admin/SearchEngineTest.php | 44 +++++++++++++++++++ .../Phrasea/Controller/Admin/SphinxTest.php | 43 ------------------ 2 files changed, 44 insertions(+), 43 deletions(-) create mode 100644 tests/Alchemy/Phrasea/Controller/Admin/SearchEngineTest.php delete mode 100644 tests/Alchemy/Phrasea/Controller/Admin/SphinxTest.php diff --git a/tests/Alchemy/Phrasea/Controller/Admin/SearchEngineTest.php b/tests/Alchemy/Phrasea/Controller/Admin/SearchEngineTest.php new file mode 100644 index 0000000000..ef4a0e68ac --- /dev/null +++ b/tests/Alchemy/Phrasea/Controller/Admin/SearchEngineTest.php @@ -0,0 +1,44 @@ +request('GET', '/admin/search-engine/'); + $this->assertTrue(self::$DI['client']->getResponse()->isOk()); + } + + /** + * @dataProvider getSearchEngines + */ + public function testPostConfiguration($searchEngine) + { + self::$DI['app']['phraseanet.SE'] = $searchEngine; + + self::$DI['client']->request('POST', '/admin/search-engine/'); + $this->assertTrue(self::$DI['client']->getResponse()->isRedirect()); + } + + public function getSearchEngines() + { + $app = new Application('test'); + + return array( + array(new PhraseaEngine($app)), + array(new SphinxSearchEngine($app, 'localhost', 9306, 'localhost', 9308)), + ); + } + +} diff --git a/tests/Alchemy/Phrasea/Controller/Admin/SphinxTest.php b/tests/Alchemy/Phrasea/Controller/Admin/SphinxTest.php deleted file mode 100644 index 82f86082b6..0000000000 --- a/tests/Alchemy/Phrasea/Controller/Admin/SphinxTest.php +++ /dev/null @@ -1,43 +0,0 @@ -setAdmin(true); - - self::$DI['client']->request('GET', '/admin/sphinx/configuration/'); - $this->assertTrue(self::$DI['client']->getResponse()->isOk()); - } - - /** - * @covers Alchemy\Phrasea\Controller\Admin\Sphinx::getConfiguration - * @expectedException \Symfony\Component\HttpKernel\Exception\HttpException - */ - public function testGetConfigurationUnauthorizedException() - { - $this->setAdmin(false); - - self::$DI['client']->request('GET', '/admin/sphinx/configuration/'); - $this->assertTrue(self::$DI['client']->getResponse()->isOk()); - } - - /** - * @covers Alchemy\Phrasea\Controller\Admin\Sphinx::submitConfiguration - */ - public function testPostConfiguration() - { - $this->setAdmin(true); - - self::$DI['client']->request('POST', '/admin/sphinx/configuration/'); - $this->assertTrue(self::$DI['client']->getResponse()->isRedirect()); - } -}