diff --git a/lib/unitTest/Alchemy/Phrasea/Core/Configuration/HandlerTest.php b/lib/unitTest/Alchemy/Phrasea/Core/Configuration/HandlerTest.php index a4b44ab0d9..a7f9a40fb1 100644 --- a/lib/unitTest/Alchemy/Phrasea/Core/Configuration/HandlerTest.php +++ b/lib/unitTest/Alchemy/Phrasea/Core/Configuration/HandlerTest.php @@ -67,8 +67,6 @@ class handlerTest extends \PhraseanetPHPUnitAbstract $this->assertInstanceOf('\Alchemy\Phrasea\Core\Configuration\Parser', $handler->getParser()); } - - public function testHandle() { try @@ -135,4 +133,40 @@ class handlerTest extends \PhraseanetPHPUnitAbstract } } + public function testHandleException() + { + $spec = $this->getMock( + '\Alchemy\Phrasea\Core\Configuration\Application' + , array('getConfigurationFilePath', 'getNonExtendablePath') + ); + + $spec->expects($this->any()) + ->method('getConfigurationFilePath') + ->will( + $this->returnValue( + __DIR__ . '/confTestFiles' + ) + ); + + $spec->expects($this->any()) + ->method('getNonExtendablePath') + ->will( + $this->returnValue( + array(array('NON', 'EXISTING', 'VALUE')) + ) + ); + + $handler = new Configuration\Handler($spec, new Configuration\Parser\Yaml()); + + try + { + $result = $handler->handle('unknowEnv'); + $this->fail($e->getMessage()); + } + catch (\Exception $e) + { + + } + } + } \ No newline at end of file diff --git a/lib/unitTest/Alchemy/Phrasea/Core/Configuration/ParserTest.php b/lib/unitTest/Alchemy/Phrasea/Core/Configuration/ParserTest.php index 314235b8a0..5f850ddbd3 100644 --- a/lib/unitTest/Alchemy/Phrasea/Core/Configuration/ParserTest.php +++ b/lib/unitTest/Alchemy/Phrasea/Core/Configuration/ParserTest.php @@ -22,21 +22,21 @@ use Alchemy\Phrasea\Core\Configuration\Parser\Yaml; */ class parserTest extends \PhraseanetPHPUnitAbstract { - + public function testParser() { $parser = new Yaml(); - + $filename = $fileName = __DIR__ . '/confTestFiles/good.yml'; - + $file = new SplFileObject($filename); $result = $parser->parse($file); - + $this->assertTrue(is_array($result)); - + $filename = $fileName = __DIR__ . '/confTestFiles/test.json'; - + $file = new SplFileObject($filename); try @@ -44,11 +44,28 @@ class parserTest extends \PhraseanetPHPUnitAbstract $result = $parser->parse($file); $this->fail('An exception shoud have been raised'); } - catch(Exception $e) + catch (Exception $e) { } - - } + + public function testDumper() + { + $parser = new Yaml(); + + $test = array("hello" => "you"); + + try + { + $result = $parser->dump($test); + $this->assertTrue(is_string($result)); + $this->assertRegexp("#hello: you#", $result); + } + catch (Exception $e) + { + + } + } + } \ No newline at end of file