Fix tests

This commit is contained in:
Romain Neutron
2012-02-21 18:03:05 +01:00
parent c3aa3b135d
commit 00fad09ed8
4 changed files with 49 additions and 50 deletions

View File

@@ -23,7 +23,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Application; use Symfony\Component\Console\Application;
require_once dirname(__FILE__) . '/../lib/classes/bootstrap.class.php'; $Core = require_once dirname(__FILE__) . '/../lib/bootstrap.php';
$result_code = 1; $result_code = 1;

View File

@@ -24,40 +24,39 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Application; use Symfony\Component\Console\Application;
use Alchemy\Phrasea; use Alchemy\Phrasea;
require_once dirname(__FILE__) . '/../lib/classes/bootstrap.class.php'; $Core = require_once dirname(__FILE__) . '/../lib/bootstrap.php';
bootstrap::register_autoloads(); bootstrap::register_autoloads();
try try
{ {
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler( $handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
new \Alchemy\Phrasea\Core\Configuration\Application(), new \Alchemy\Phrasea\Core\Configuration\Application(),
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml() new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
); );
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler); $configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
$serviceName = $configuration->getOrm(); $serviceName = $configuration->getOrm();
$confService = $configuration->getService($serviceName); $confService = $configuration->getService($serviceName);
if($confService->get("type") !== 'doctrine') if ($confService->get("type") !== 'Orm\\Doctrine')
{ {
exit(sprintf("Doctrine is not declared as your ORM but %s is", $confService->get("type"))); exit(sprintf("Doctrine is not declared as your ORM but %s is", $confService->get("type")));
} }
$ormServiceBuilder = new \Alchemy\Phrasea\Core\ServiceBuilder\Orm( $ormService = \Alchemy\Phrasea\Core\Service\Builder::create(
$serviceName $Core
, $confService , $serviceName
, array('registry' => \registry::get_instance()) , $confService
); );
$ormService = $ormServiceBuilder->buildService(); $em = $ormService->getDriver();
$em = $ormService->getService();
/* @var $em \Doctrine\ORM\EntityManager */ /* @var $em \Doctrine\ORM\EntityManager */
$app = new Application("Phraseanet Doctrine Console", $ormService->getVersion()); $app = new Application("Phraseanet Doctrine Console");
$helpers = array( $helpers = array(
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()), 'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em) 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
); );
$helperSet = $app->getHelperSet(); $helperSet = $app->getHelperSet();
@@ -67,24 +66,24 @@ try
} }
$app->addCommands(array( $app->addCommands(array(
// DBAL Commands // DBAL Commands
new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(), new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(),
new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(), new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(),
// ORM Commands // ORM Commands
new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(),
new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(),
new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(),
new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(),
new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(),
new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(),
new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(), new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(),
new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(),
new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(),
new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(),
new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(),
new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(),
new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(), new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(),
new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand(), new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand(),
)); ));
$app->run(); $app->run();

View File

@@ -453,7 +453,7 @@ class module_console_fileEnsureProductionSetting extends Command
} }
$registry = \registry::get_instance(); $registry = \registry::get_instance();
$service = new Core\Service\Builder( $service = Core\Service\Builder::create(
\bootstrap::getCore() \bootstrap::getCore()
, $ormName , $ormName
, $configuration , $configuration

View File

@@ -823,13 +823,13 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
$serviceName = $configuration->getTemplating(); $serviceName = $configuration->getTemplating();
$confService = $configuration->getService($serviceName); $confService = $configuration->getService($serviceName);
$templateServiceBuilder = \Alchemy\Phrasea\Core\Service\Builder::create( $templateService = \Alchemy\Phrasea\Core\Service\Builder::create(
self::$core, self::$core,
$serviceName $serviceName
, $confService , $confService
); );
$this->app['Core']["Twig"] = $templateServiceBuilder->getDriver(); $this->app['Core']["Twig"] = $templateService->getDriver();
} }
/** /**