Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Cli tools #189

Closed
wants to merge 4 commits into from

2 participants

Aleksandr Sandrovskiy Marco Pivetta
Aleksandr Sandrovskiy

Commands as services
Configuring migrations using ZF2 config

Marco Pivetta
Owner

@Sundrique I'm pulling this in and working on it today :)

Marco Pivetta
Owner

Rebased, cleaned and merged in #211, thank you =D

Marco Pivetta Ocramius closed this
Aleksandr Sandrovskiy

Great! You are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 19, 2013
  1. Aleksandr Sandrovskiy
Commits on Mar 20, 2013
  1. Aleksandr Sandrovskiy
Commits on Mar 21, 2013
  1. Aleksandr Sandrovskiy
  2. Aleksandr Sandrovskiy

    Fix indentation and braces

    Sundrique authored
This page is out of date. Refresh to see the latest.
3  composer.json
View
@@ -39,7 +39,8 @@
"zendframework/zend-stdlib": "2.*",
"zendframework/zend-form": "2.*",
"zendframework/zend-mvc": "2.*",
- "zendframework/zend-servicemanager": "2.*"
+ "zendframework/zend-servicemanager": "2.*",
+ "zendframework/zend-config": "2.*"
},
"require-dev": {
"zendframework/zend-developer-tools": "dev-master",
2  config/controllers.config.php
View
@@ -36,5 +36,5 @@
new \Zend\Http\Client('http://yuml.me/diagram/class/', array('timeout' => 30))
);
},
- ),
+ )
);
45 config/module.config.php
View
@@ -28,16 +28,16 @@
// event manager instance to use. The retrieved service name will
// be `doctrine.eventmanager.$thisSetting`
- 'eventmanager' => 'orm_default',
+ 'eventmanager' => 'orm_default',
// connection parameters, see
// http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html
'params' => array(
- 'host' => 'localhost',
- 'port' => '3306',
- 'user' => 'username',
+ 'host' => 'localhost',
+ 'port' => '3306',
+ 'user' => 'username',
'password' => 'password',
- 'dbname' => 'database',
+ 'dbname' => 'database',
)
),
),
@@ -49,33 +49,33 @@
'orm_default' => array(
// metadata cache instance to use. The retrieved service name will
// be `doctrine.cache.$thisSetting`
- 'metadata_cache' => 'array',
+ 'metadata_cache' => 'array',
// DQL queries parsing cache instance to use. The retrieved service
// name will be `doctrine.cache.$thisSetting`
- 'query_cache' => 'array',
+ 'query_cache' => 'array',
// ResultSet cache to use. The retrieved service name will be
// `doctrine.cache.$thisSetting`
- 'result_cache' => 'array',
+ 'result_cache' => 'array',
// Mapping driver instance to use. Change this only if you don't want
// to use the default chained driver. The retrieved service name will
// be `doctrine.driver.$thisSetting`
- 'driver' => 'orm_default',
+ 'driver' => 'orm_default',
// Generate proxies automatically (turn off for production)
- 'generate_proxies' => true,
+ 'generate_proxies' => true,
// directory where proxies will be stored. By default, this is in
// the `data` directory of your application
- 'proxy_dir' => 'data/DoctrineORMModule/Proxy',
+ 'proxy_dir' => 'data/DoctrineORMModule/Proxy',
// namespace for generated proxy classes
- 'proxy_namespace' => 'DoctrineORMModule\Proxy',
+ 'proxy_namespace' => 'DoctrineORMModule\Proxy',
// SQL filters. See http://docs.doctrine-project.org/en/latest/reference/filters.html
- 'filters' => array()
+ 'filters' => array()
)
),
@@ -85,7 +85,7 @@
'orm_default' => array(
// By default, the ORM module uses a driver chain. This allows multiple
// modules to define their own entities
- 'class' => 'Doctrine\ORM\Mapping\Driver\DriverChain',
+ 'class' => 'Doctrine\ORM\Mapping\Driver\DriverChain',
// Map of driver names to be used within this driver chain, indexed by
// entity namespace
@@ -99,7 +99,7 @@
'orm_default' => array(
// connection instance to use. The retrieved service name will
// be `doctrine.connection.$thisSetting`
- 'connection' => 'orm_default',
+ 'connection' => 'orm_default',
// configuration instance to use. The retrieved service name will
// be `doctrine.configuration.$thisSetting`
@@ -135,6 +135,13 @@
//'credentialProperty' => 'password'
),
),
+
+ // migrations configuration
+ 'migrations' => array(
+ 'directory' => 'data/DoctrineORMModule/Migrations',
+ 'namespace' => 'DoctrineORMModule\Migrations',
+ 'table' => 'migrations'
+ )
),
////////////////////////////////////////////////////////////////////
@@ -151,7 +158,7 @@
'route' => '/ocra_service_manager_yuml',
'defaults' => array(
'controller' => 'DoctrineORMModule\\Yuml\\YumlController',
- 'action' => 'index',
+ 'action' => 'index',
),
),
),
@@ -160,7 +167,7 @@
'view_manager' => array(
'template_map' => array(
- 'zend-developer-tools/toolbar/doctrine-orm-queries' => __DIR__ . '/../view/zend-developer-tools/toolbar/doctrine-orm-queries.phtml',
+ 'zend-developer-tools/toolbar/doctrine-orm-queries' => __DIR__ . '/../view/zend-developer-tools/toolbar/doctrine-orm-queries.phtml',
'zend-developer-tools/toolbar/doctrine-orm-mappings' => __DIR__ . '/../view/zend-developer-tools/toolbar/doctrine-orm-mappings.phtml',
),
),
@@ -168,13 +175,13 @@
'zenddevelopertools' => array(
'profiler' => array(
'collectors' => array(
- 'orm_default' => 'doctrine.sql_logger_collector.orm_default',
+ 'orm_default' => 'doctrine.sql_logger_collector.orm_default',
'orm_default_mappings' => 'doctrine.mapping_collector.orm_default',
),
),
'toolbar' => array(
'entries' => array(
- 'orm_default' => 'zend-developer-tools/toolbar/doctrine-orm-queries',
+ 'orm_default' => 'zend-developer-tools/toolbar/doctrine-orm-queries',
'orm_default_mappings' => 'zend-developer-tools/toolbar/doctrine-orm-mappings',
),
),
72 config/services.config.php
View
@@ -23,25 +23,69 @@
),
'factories' => array(
- 'doctrine.authenticationadapter.orm_default' => new DoctrineModule\Service\Authentication\AdapterFactory('orm_default'),
- 'doctrine.authenticationstorage.orm_default' => new DoctrineModule\Service\Authentication\StorageFactory('orm_default'),
- 'doctrine.authenticationservice.orm_default' => new DoctrineModule\Service\Authentication\AuthenticationServiceFactory('orm_default'),
-
- 'doctrine.connection.orm_default' => new DoctrineORMModule\Service\DBALConnectionFactory('orm_default'),
- 'doctrine.configuration.orm_default' => new DoctrineORMModule\Service\ConfigurationFactory('orm_default'),
- 'doctrine.entitymanager.orm_default' => new DoctrineORMModule\Service\EntityManagerFactory('orm_default'),
-
- 'doctrine.driver.orm_default' => new DoctrineModule\Service\DriverFactory('orm_default'),
- 'doctrine.eventmanager.orm_default' => new DoctrineModule\Service\EventManagerFactory('orm_default'),
- 'doctrine.entity_resolver.orm_default' => new DoctrineORMModule\Service\EntityResolverFactory('orm_default'),
- 'doctrine.sql_logger_collector.orm_default' => new DoctrineORMModule\Service\SQLLoggerCollectorFactory('orm_default'),
- 'doctrine.mapping_collector.orm_default' => function (Zend\ServiceManager\ServiceLocatorInterface $sl) {
+ 'doctrine.authenticationadapter.orm_default' => new DoctrineModule\Service\Authentication\AdapterFactory('orm_default'),
+ 'doctrine.authenticationstorage.orm_default' => new DoctrineModule\Service\Authentication\StorageFactory('orm_default'),
+ 'doctrine.authenticationservice.orm_default' => new DoctrineModule\Service\Authentication\AuthenticationServiceFactory('orm_default'),
+
+ 'doctrine.connection.orm_default' => new DoctrineORMModule\Service\DBALConnectionFactory('orm_default'),
+ 'doctrine.configuration.orm_default' => new DoctrineORMModule\Service\ConfigurationFactory('orm_default'),
+ 'doctrine.entitymanager.orm_default' => new DoctrineORMModule\Service\EntityManagerFactory('orm_default'),
+
+ 'doctrine.driver.orm_default' => new DoctrineModule\Service\DriverFactory('orm_default'),
+ 'doctrine.eventmanager.orm_default' => new DoctrineModule\Service\EventManagerFactory('orm_default'),
+ 'doctrine.entity_resolver.orm_default' => new DoctrineORMModule\Service\EntityResolverFactory('orm_default'),
+ 'doctrine.sql_logger_collector.orm_default' => new DoctrineORMModule\Service\SQLLoggerCollectorFactory('orm_default'),
+ 'doctrine.mapping_collector.orm_default' => function (Zend\ServiceManager\ServiceLocatorInterface $sl) {
$em = $sl->get('doctrine.entitymanager.orm_default');
return new DoctrineORMModule\Collector\MappingCollector($em->getMetadataFactory(), 'orm_default_mappings');
},
- 'DoctrineORMModule\Form\Annotation\AnnotationBuilder' => function(Zend\ServiceManager\ServiceLocatorInterface $sl) {
+ 'DoctrineORMModule\Form\Annotation\AnnotationBuilder' => function (Zend\ServiceManager\ServiceLocatorInterface $sl) {
return new DoctrineORMModule\Form\Annotation\AnnotationBuilder($sl->get('doctrine.entitymanager.orm_default'));
},
+
+ 'doctrine.migrations_configuration' => function ($serviceManager) {
+ $connection = $serviceManager->get('doctrine.connection.orm_default');
+
+ $appConfig = $serviceManager->get('Config');
+ $migrationsConfig = $appConfig['doctrine']['migrations'];
+
+ $configuration = new \Doctrine\DBAL\Migrations\Configuration\Configuration($connection);
+ $configuration->setMigrationsDirectory($migrationsConfig['directory']);
+ $configuration->setMigrationsNamespace($migrationsConfig['namespace']);
+ $configuration->setMigrationsTableName($migrationsConfig['table']);
+ $configuration->registerMigrationsFromDirectory($migrationsConfig['directory']);
+
+ return $configuration;
+ },
+ // Migrations commands
+ 'doctrine.cmd.migrations.generate' => new \DoctrineORMModule\Service\MigrationsCommandFactory('generate'),
+ 'doctrine.cmd.migrations.execute' => new \DoctrineORMModule\Service\MigrationsCommandFactory('execute'),
+ 'doctrine.cmd.migrations.migrate' => new \DoctrineORMModule\Service\MigrationsCommandFactory('migrate'),
+ 'doctrine.cmd.migrations.status' => new \DoctrineORMModule\Service\MigrationsCommandFactory('status'),
+ 'doctrine.cmd.migrations.version' => new \DoctrineORMModule\Service\MigrationsCommandFactory('version'),
+ 'doctrine.cmd.migrations.diff' => new \DoctrineORMModule\Service\MigrationsCommandFactory('diff'),
),
+
+ 'invokables' => array(
+ // DBAL commands
+ 'doctrine.cmd.dbal.runsql' => '\Doctrine\DBAL\Tools\Console\Command\RunSqlCommand',
+ 'doctrine.cmd.dbal.import' => '\Doctrine\DBAL\Tools\Console\Command\ImportCommand',
+ // ORM Commands
+ 'doctrine.cmd.orm.clear-cache.metadata' => '\Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand',
+ 'doctrine.cmd.orm.clear-cache.result' => '\Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand',
+ 'doctrine.cmd.orm.clear-cache.query' => '\Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand',
+ 'doctrine.cmd.orm.schema-tool.create' => '\Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand',
+ 'doctrine.cmd.orm.schema-tool.update' => '\Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand',
+ 'doctrine.cmd.orm.schema-tool.drop' => '\Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand',
+ 'doctrine.cmd.orm.ensure-production-settings' => '\Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand',
+ 'doctrine.cmd.orm.convert-d1-schema' => '\Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand',
+ 'doctrine.cmd.orm.generate-repositories' => '\Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand',
+ 'doctrine.cmd.orm.generate-entities' => '\Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand',
+ 'doctrine.cmd.orm.generate-proxies' => '\Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand',
+ 'doctrine.cmd.orm.convert-mapping' => '\Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand',
+ 'doctrine.cmd.orm.run-dql' => '\Doctrine\ORM\Tools\Console\Command\RunDqlCommand',
+ 'doctrine.cmd.orm.validate-schema' => '\Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand',
+ 'doctrine.cmd.orm.info' => '\Doctrine\ORM\Tools\Console\Command\InfoCommand',
+ )
);
58 src/DoctrineORMModule/Module.php
View
@@ -31,16 +31,9 @@
use Zend\Loader\StandardAutoloader;
use Zend\EventManager\EventInterface;
-use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Symfony\Component\Console\Helper\DialogHelper;
use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
-use Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand;
-use Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand;
-use Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand;
-use Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand;
-use Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand;
-use Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand;
/**
* Base module for Doctrine ORM.
@@ -58,6 +51,7 @@ class Module implements
ConfigProviderInterface,
InitProviderInterface
{
+
/**
* {@inheritDoc}
*/
@@ -65,7 +59,7 @@ public function init(ModuleManagerInterface $manager)
{
$events = $manager->getEventManager();
// Initialize logger collector once the profiler is initialized itself
- $events->attach('profiler_init', function() use ($manager) {
+ $events->attach('profiler_init', function () use ($manager) {
$manager->getEvent()->getParam('ServiceManager')->get('doctrine.sql_logger_collector.orm_default');
});
}
@@ -90,29 +84,49 @@ public function getAutoloaderConfig()
public function onBootstrap(EventInterface $e)
{
/* @var $app \Zend\Mvc\ApplicationInterface */
- $app = $e->getTarget();
+ $app = $e->getTarget();
$events = $app->getEventManager()->getSharedManager();
+ $serviceManager = $app->getServiceManager();
// Attach to helper set event and load the entity manager helper.
- $events->attach('doctrine', 'loadCli.post', function(EventInterface $e) {
+ $events->attach('doctrine', 'loadCli.post', function (EventInterface $e) {
/* @var $cli \Symfony\Component\Console\Application */
$cli = $e->getTarget();
- ConsoleRunner::addCommands($cli);
+ /* @var $sm ServiceLocatorInterface */
+ $sm = $e->getParam('ServiceManager');
+
+ $ORMCommands = array(
+ $sm->get('doctrine.cmd.dbal.runsql'),
+ $sm->get('doctrine.cmd.dbal.import'),
+ $sm->get('doctrine.cmd.orm.clear-cache.metadata'),
+ $sm->get('doctrine.cmd.orm.clear-cache.result'),
+ $sm->get('doctrine.cmd.orm.clear-cache.query'),
+ $sm->get('doctrine.cmd.orm.schema-tool.create'),
+ $sm->get('doctrine.cmd.orm.schema-tool.update'),
+ $sm->get('doctrine.cmd.orm.schema-tool.drop'),
+ $sm->get('doctrine.cmd.orm.ensure-production-settings'),
+ $sm->get('doctrine.cmd.orm.convert-d1-schema'),
+ $sm->get('doctrine.cmd.orm.generate-repositories'),
+ $sm->get('doctrine.cmd.orm.generate-entities'),
+ $sm->get('doctrine.cmd.orm.generate-proxies'),
+ $sm->get('doctrine.cmd.orm.convert-mapping'),
+ $sm->get('doctrine.cmd.orm.run-dql'),
+ $sm->get('doctrine.cmd.orm.validate-schema'),
+ $sm->get('doctrine.cmd.orm.info'),
+ );
if (class_exists('Doctrine\\DBAL\\Migrations\\Version')) {
- $cli->addCommands(array(
- new DiffCommand(),
- new ExecuteCommand(),
- new GenerateCommand(),
- new MigrateCommand(),
- new StatusCommand(),
- new VersionCommand(),
- ));
+ $ORMCommands[] = $sm->get('doctrine.cmd.migrations.execute');
+ $ORMCommands[] = $sm->get('doctrine.cmd.migrations.generate');
+ $ORMCommands[] = $sm->get('doctrine.cmd.migrations.migrate');
+ $ORMCommands[] = $sm->get('doctrine.cmd.migrations.status');
+ $ORMCommands[] = $sm->get('doctrine.cmd.migrations.version');
+ $ORMCommands[] = $sm->get('doctrine.cmd.migrations.diff');
}
- /* @var $sm ServiceLocatorInterface */
- $sm = $e->getParam('ServiceManager');
+ $cli->addCommands($ORMCommands);
+
/* @var $em \Doctrine\ORM\EntityManager */
$em = $sm->get('doctrine.entitymanager.orm_default');
$helperSet = $cli->getHelperSet();
@@ -121,7 +135,7 @@ public function onBootstrap(EventInterface $e)
$helperSet->set(new EntityManagerHelper($em), 'em');
});
- $app->getServiceManager()->get('doctrine.entity_resolver.orm_default');
+ $serviceManager->get('doctrine.entity_resolver.orm_default');
}
/**
65 src/DoctrineORMModule/Service/MigrationsCommandFactory.php
View
@@ -0,0 +1,65 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the MIT license.
+ */
+
+namespace DoctrineORMModule\Service;
+
+use Zend\ServiceManager\FactoryInterface;
+use Zend\ServiceManager\ServiceLocatorInterface;
+
+/**
+ * Service factory for migrations command
+ *
+ * @license MIT
+ * @author Aleksandr Sandrovskiy <a.sandrovsky@gmail.com>
+ */
+class MigrationsCommandFactory implements FactoryInterface
+{
+
+ /**
+ * @var string
+ */
+ private $name;
+
+ /**
+ * @param $name
+ */
+ public function __construct($name)
+ {
+ $this->name = ucfirst(strtolower($name));
+ }
+
+ /**
+ * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator
+ * @return mixed
+ * @throws \InvalidArgumentException
+ */
+ public function createService(ServiceLocatorInterface $serviceLocator)
+ {
+ $className = '\Doctrine\DBAL\Migrations\Tools\Console\Command\\' . $this->name . 'Command';
+ if (class_exists($className)) {
+ $configuration = $serviceLocator->get('doctrine.migrations_configuration');
+
+ $command = new $className;
+ $command->setMigrationConfiguration($configuration);
+
+ return $command;
+ } else {
+ throw new \InvalidArgumentException;
+ }
+ }
+}
71 tests/DoctrineORMModuleTest/Service/MigrationsCommandFactoryTest.php
View
@@ -0,0 +1,71 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the MIT license.
+ */
+
+namespace DoctrineORMModuleTest\Service;
+
+use PHPUnit_Framework_TestCase as TestCase;
+use Zend\ServiceManager\ServiceManager;
+use DoctrineORMModuleTest\Util\ServiceManagerFactory;
+
+class MigrationsCommandFactoryTest extends TestCase
+{
+
+ /**
+ * @var
+ */
+ private $serviceLocator;
+
+ /**
+ * {@inheritDoc}
+ */
+ public function setUp()
+ {
+ $this->serviceLocator = ServiceManagerFactory::getServiceManager();
+ parent::setUp();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function tearDown()
+ {
+ $this->serviceLocator = null;
+ parent::tearDown();
+ }
+
+ public function testExecuteFactory()
+ {
+ $factory = new \DoctrineORMModule\Service\MigrationsCommandFactory('execute');
+ $command = $factory->createService($this->serviceLocator);
+ $this->assertInstanceOf('\Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand', $command);
+ }
+
+ public function testDiffFactory()
+ {
+ $factory = new \DoctrineORMModule\Service\MigrationsCommandFactory('diff');
+ $command = $factory->createService($this->serviceLocator);
+ $this->assertInstanceOf('\Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand', $command);
+ }
+
+ public function testThrowException()
+ {
+ $this->setExpectedException('InvalidArgumentException');
+ $factory = new \DoctrineORMModule\Service\MigrationsCommandFactory('unknowncommand');
+ $command = $factory->createService($this->serviceLocator);
+ }
+}
Something went wrong with that request. Please try again.