fix testes

This commit is contained in:
Nicolas Le Goff
2012-01-11 16:27:20 +01:00
parent 3125bdc7af
commit a15542748e
3 changed files with 51 additions and 24 deletions

View File

@@ -58,14 +58,13 @@ class ConfigurationTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals('prod', $configuration->getEnvironnement());
$this->assertTrue($configuration->isInstalled());
$this->assertInstanceOf(
'Alchemy\Phrasea\Core\Configuration\Parameter'
'\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag'
, $configuration->getConfiguration()
);
$this->assertFalse($configuration->isDebug());
$this->assertFalse($configuration->displayErrors());
$this->assertFalse($configuration->isDisplayingErrors());
$this->assertFalse($configuration->isMaintained());
$this->assertTrue(is_array($configuration->getPhraseanet()->all()));
// $this->assertTrue(is_array($configuration->getDoctrine()->all()));
}
public function testInstalled()
@@ -85,8 +84,15 @@ class ConfigurationTest extends PhraseanetPHPUnitAuthenticatedAbstract
$configuration->setEnvironnement('prod');
$this->assertFalse($configuration->isInstalled());
$this->assertTrue(is_array($configuration->getPhraseanet()->all()));
// $this->assertTrue(is_array($configuration->getDoctrine()->all()));
try
{
$configuration->getPhraseanet();
$this->fail("should raise an exception because application is not yet installed");
}
catch (\Exception $e)
{
}
}
public function testGetAvailableLogger()

View File

@@ -2,6 +2,11 @@
require_once dirname(__FILE__) . '/../../bootstrap.php';
$new_include_path = __DIR__ . "/../../vendor/" . PATH_SEPARATOR . get_include_path();
set_include_path($new_include_path);
require_once __DIR__ . "/../../vendor/Phlickr/Api.php";
/*
* This file is part of Phraseanet
*

View File

@@ -11,19 +11,21 @@
require_once __DIR__ . "/../../lib/classes/bootstrap.class.php";
use Silex\WebTestCase;
use Symfony\Component\HttpKernel\Client;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\Common\DataFixtures\Loader;
use PhraseaFixture\Basket as MyFixture;
/**
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
bootstrap::execute('test');
use Silex\WebTestCase;
use Symfony\Component\HttpKernel\Client;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\Common\DataFixtures\Loader;
use PhraseaFixture\Basket as MyFixture;
abstract class PhraseanetPHPUnitAbstract extends WebTestCase
{
@@ -730,8 +732,22 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
*/
protected function resetTwig()
{
$serviceTwig = new \Alchemy\Phrasea\Core\Service\Twig(array());
$this->app['Core']["Twig"] = $serviceTwig->getTwig();
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
new \Alchemy\Phrasea\Core\Configuration\Application(),
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
);
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
$serviceName = $configuration->getTemplating();
$confService = $configuration->getService($serviceName);
$templateService = \Alchemy\Phrasea\Core\ServiceBuilder::build(
$serviceName
, \Alchemy\Phrasea\Core\ServiceBuilder::TEMPLATE_ENGINE
, $confService->get("type")
, $confService->get("options")
);
$this->app['Core']["Twig"] = $templateService->getService();
}
/**