Permalink
Browse files

Moving DBAL related configuration to ORM module, fixing tests bootstr…

…apper (still using Configuration instead of Config
  • Loading branch information...
1 parent cabab9a commit e5b98e911d3208641f081b3a28d14edc123ad482 @Ocramius Ocramius committed Jul 22, 2012
View
94 docs/EXTRAS_ORM.md
@@ -0,0 +1,94 @@
+# Extra goodies included with DoctrineModule
+The items listed below are entirely optional and are intended to enhance integration between Zend Framework 2 and
+Doctrine 2 .
+
+## ObjectExists and NoObjectExists Validators
+The ObjectExists and NoObjectExists are validators similar to Zend\Validator\Db validators. You can
+pass a variety of options to determine validity. The most basic use case requires an entity manager (em),
+an entity, and a field. You also have the option of specifying a query_builder Closure to use if you
+want to fine tune the results.
+
+```php
+<?php
+$validator = new \DoctrineModule\Validator\NoObjectExists(array(
+ // object repository to lookup
+ 'object_repository' => $serviceLocator->get('Doctrine\ORM\EntityManager')->getRepository('My\Entity\User'),
+
+ // fields to match
+ 'fields' => array('username'),
+));
+
+// following works also with simple values if the number of fields to be matched is 1
+echo $validator->isValid(array('username' => 'test')) ? 'Valid' : 'Invalid! Duplicate found!';
+```
+
+## Authentication adapter for Zend\Authentication
+The authentication adapter is intended to provide an adapter for `Zend\Authentication`. It works much
+like the `DbTable` adapter in the core framework. You must provide the entity manager instance,
+entity name, identity field, and credential field. You can optionally provide a callable method
+to perform hashing on the password prior to checking for validation.
+
+```php
+<?php
+$adapter = new \DoctrineModule\Authentication\Adapter\DoctrineObject(
+ $this->getLocator()->get('Doctrine\ORM\EntityManager'),
+ 'Application\Test\Entity',
+ 'username', // optional, default shown
+ 'password', // optional, default shown,
+ function($identity, $credential) { // optional callable
+ return \My\Service\User::hashCredential(
+ $credential,
+ $identity->getSalt(),
+ $identity->getAlgorithm()
+ );
+ }
+);
+
+$adapter->setIdentityValue('admin');
+$adapter->setCredentialValue('pa55w0rd');
+$result = $adapter->authenticate();
+
+echo $result->isValid() ? 'Authenticated!' : 'Could not authenticate';
+```
+
+## Custom DBAL Types
+To register custom Doctrine DBAL types, simply add them to the `doctrine.configuration.my_dbal_default.types`
+key in you configuration file:
+
+```php
+<?php
+return array(
+ 'doctrine' => array(
+ 'configuration' => array(
+ 'my_dbal_default' => array(
+ 'types' => array(
+ // You can override a default type
+ 'date' => 'My\DBAL\Types\DateType',
+
+ // And set new ones
+ 'tinyint' => 'My\DBAL\Types\TinyIntType',
+ ),
+ ),
+ ),
+ ),
+);
+```
+
+You are now able to use them, for example, in your ORM entities:
+
+```php
+<?php
+
+class User
+{
+ /**
+ * @ORM\Column(type="date")
+ */
+ protected $birthdate;
+
+ /**
+ * @ORM\Column(type="tinyint")
+ */
+ protected $houses;
+}
+```
View
22 src/DoctrineORMModule/Module.php
@@ -21,13 +21,15 @@
use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
-use DoctrineModule\Service as CommonService;
-use DoctrineORMModule\Service as ORMService;
+use DoctrineModule\Service\DriverFactory;
+use DoctrineModule\Service\EventManagerFactory;
+use DoctrineORMModule\Service\ConfigurationFactory as ORMConfigurationFactory;
+use DoctrineORMModule\Service\EntityManagerFactory;
+use DoctrineORMModule\Service\DBALConnectionFactory;
use Zend\ModuleManager\ModuleManagerInterface;
use Zend\ModuleManager\Feature\ServiceProviderInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
-use Zend\ModuleManager\ModuleEvent;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\EventManager\EventInterface;
@@ -41,8 +43,6 @@
use Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand;
use Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand;
-use ReflectionClass;
-
/**
* Base module for Doctrine ORM.
*
@@ -121,11 +121,13 @@ public function getServiceConfig()
$sl->get('doctrine.entitymanager.orm_default')
);
},
- 'doctrine.connection.orm_default' => new CommonService\ConnectionFactory('orm_default'),
- 'doctrine.configuration.orm_default' => new ORMService\ConfigurationFactory('orm_default'),
- 'doctrine.driver.orm_default' => new CommonService\DriverFactory('orm_default'),
- 'doctrine.entitymanager.orm_default' => new ORMService\EntityManagerFactory('orm_default'),
- 'doctrine.eventmanager.orm_default' => new CommonService\EventManagerFactory('orm_default'),
+
+ 'doctrine.connection.orm_default' => new DBALConnectionFactory('orm_default'),
+ 'doctrine.configuration.orm_default' => new ORMConfigurationFactory('orm_default'),
+ 'doctrine.entitymanager.orm_default' => new EntityManagerFactory('orm_default'),
+
+ 'doctrine.driver.orm_default' => new DriverFactory('orm_default'),
+ 'doctrine.eventmanager.orm_default' => new EventManagerFactory('orm_default'),
)
);
}
View
14 src/DoctrineORMModule/Options/Configuration.php
@@ -2,9 +2,17 @@
namespace DoctrineORMModule\Options;
-use DoctrineModule\Options\Configuration as DoctrineConfiguration;
-
-class Configuration extends DoctrineConfiguration
+use DoctrineORMModule\Options\DBALConfiguration;
+
+/**
+ * Configuration options for an ORM Configuration
+ *
+ * @license MIT
+ * @link http://www.doctrine-project.org/
+ * @author Kyle Spraggs <theman@spiffyjr.me>
+ * @author Marco Pivetta <ocramius@gmail.com>
+ */
+class Configuration extends DBALConfiguration
{
/**
* Set the cache key for the metadata cache. Cache key
View
104 src/DoctrineORMModule/Options/DBALConfiguration.php
@@ -0,0 +1,104 @@
+<?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. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace DoctrineORMModule\Options;
+
+use Zend\Stdlib\AbstractOptions;
+
+/**
+ * Configuration options for a DBAL Connection
+ *
+ * @license MIT
+ * @link http://www.doctrine-project.org/
+ * @author Kyle Spraggs <theman@spiffyjr.me>
+ */
+class DBALConfiguration extends AbstractOptions
+{
+ /**
+ * Set the cache key for the result cache. Cache key
+ * is assembled as "doctrine.cache.{key}" and pulled from
+ * service locator.
+ *
+ * @var string
+ */
+ protected $resultCache = 'array';
+
+ /**
+ * Set the class name of the SQL Logger, or null, to disable.
+ *
+ * @var string
+ */
+ protected $sqlLogger = null;
+
+ /**
+ * Keys must be the name of the type identifier and value is
+ * the class name of the Type
+ *
+ * @var array
+ */
+ protected $types = array();
+
+ /**
+ * @param string $resultCache
+ */
+ public function setResultCache($resultCache)
+ {
+ $this->resultCache = $resultCache;
+ }
+
+ /**
+ * @return string
+ */
+ public function getResultCache()
+ {
+ return 'doctrine.cache.' . $this->resultCache;
+ }
+
+ /**
+ * @param string $sqlLogger
+ */
+ public function setSqlLogger($sqlLogger)
+ {
+ $this->sqlLogger = $sqlLogger;
+ }
+
+ /**
+ * @return string
+ */
+ public function getSqlLogger()
+ {
+ return $this->sqlLogger;
+ }
+
+ /**
+ * @param array $types
+ */
+ public function setTypes(array $types)
+ {
+ $this->types = $types;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTypes()
+ {
+ return $this->types;
+ }
+}
View
202 src/DoctrineORMModule/Options/DBALConnection.php
@@ -0,0 +1,202 @@
+<?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. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace DoctrineORMModule\Options;
+
+use Zend\Stdlib\AbstractOptions;
+
+/**
+ * DBAL Connection options
+ *
+ * @license MIT
+ * @link http://www.doctrine-project.org/
+ * @author Kyle Spraggs <theman@spiffyjr.me>
+ */
+class DBALConnection extends AbstractOptions
+{
+ /**
+ * Set the configuration key for the Configuration. Configuration key
+ * is assembled as "doctrine.configuration.{key}" and pulled from
+ * service locator.
+ *
+ * @var string
+ */
+ protected $configuration = 'orm_default';
+
+ /**
+ * Set the eventmanager key for the EventManager. EventManager key
+ * is assembled as "doctrine.eventmanager.{key}" and pulled from
+ * service locator.
+ *
+ * @var string
+ */
+ protected $eventmanager = 'orm_default';
+
+ /**
+ * Set the PDO instance, if any, to use. If a string is set
+ * then the alias is pulled from the service locator.
+ *
+ * @var null|string|\PDO
+ */
+ protected $pdo = null;
+
+ /**
+ * Setting the driver is deprecated. You should set the
+ * driver class directly instead.
+ *
+ * @var string
+ */
+ protected $driverClass = 'Doctrine\DBAL\Driver\PDOMySql\Driver';
+
+ /**
+ * Set the wrapper class for the driver. In general, this shouldn't
+ * need to be changed.
+ *
+ * @var string|null
+ */
+ protected $wrapperClass = null;
+
+ /**
+ * Driver specific connection parameters.
+ *
+ * @var array
+ */
+ protected $params = array();
+
+ /**
+ * @var array
+ */
+ protected $doctrineTypeMappings = array();
+
+ /**
+ * @param string $configuration
+ */
+ public function setConfiguration($configuration)
+ {
+ $this->configuration = $configuration;
+ }
+
+ /**
+ * @return string
+ */
+ public function getConfiguration()
+ {
+ return "doctrine.configuration.{$this->configuration}";
+ }
+
+ /**
+ * @param string $eventmanager
+ */
+ public function setEventmanager($eventmanager)
+ {
+ $this->eventmanager = $eventmanager;
+ }
+
+ /**
+ * @return string
+ */
+ public function getEventmanager()
+ {
+ return "doctrine.eventmanager.{$this->eventmanager}";
+ }
+
+ /**
+ * @param array $params
+ */
+ public function setParams($params)
+ {
+ $this->params = $params;
+ }
+
+ /**
+ * @return array
+ */
+ public function getParams()
+ {
+ return $this->params;
+ }
+
+ /**
+ * @param array $doctrineTypeMappings
+ * @return \DoctrineORMModule\Options\DBALConnection
+ */
+ public function setDoctrineTypeMappings($doctrineTypeMappings)
+ {
+ $this->doctrineTypeMappings = (array) $doctrineTypeMappings;
+
+ return $this;
+ }
+
+ /**
+ *
+ * @return array
+ */
+ public function getDoctrineTypeMappings()
+ {
+ return $this->doctrineTypeMappings;
+ }
+
+ /**
+ * @param null|string $driverClass
+ */
+ public function setDriverClass($driverClass)
+ {
+ $this->driverClass = $driverClass;
+ }
+
+ /**
+ * @return null|string
+ */
+ public function getDriverClass()
+ {
+ return $this->driverClass;
+ }
+
+ /**
+ * @param null|\PDO|string $pdo
+ */
+ public function setPdo($pdo)
+ {
+ $this->pdo = $pdo;
+ }
+
+ /**
+ * @return null|\PDO|string
+ */
+ public function getPdo()
+ {
+ return $this->pdo;
+ }
+
+ /**
+ * @param string $wrapperClass
+ */
+ public function setWrapperClass($wrapperClass)
+ {
+ $this->wrapperClass = $wrapperClass;
+ }
+
+ /**
+ * @return string
+ */
+ public function getWrapperClass()
+ {
+ return $this->wrapperClass;
+ }
+}
View
4 src/DoctrineORMModule/Options/EntityManager.php
@@ -31,6 +31,7 @@ class EntityManager extends AbstractOptions
public function setConfiguration($configuration)
{
$this->configuration = $configuration;
+
return $this;
}
@@ -49,6 +50,7 @@ public function getConfiguration()
public function setConnection($connection)
{
$this->connection = $connection;
+
return $this;
}
@@ -58,6 +60,6 @@ public function setConnection($connection)
*/
public function getConnection()
{
- return "doctrine.connection.{$this->connection}";
+ return 'doctrine.connection.' . $this->connection;
}
}
View
2 src/DoctrineORMModule/Service/ConfigurationFactory.php
@@ -2,7 +2,7 @@
namespace DoctrineORMModule\Service;
-use DoctrineModule\Service\ConfigurationFactory as DoctrineConfigurationFactory;
+use DoctrineORMModule\Service\DBALConfigurationFactory as DoctrineConfigurationFactory;
use Zend\ServiceManager\ServiceLocatorInterface;
class ConfigurationFactory extends DoctrineConfigurationFactory
View
111 src/DoctrineORMModule/Service/DBALConfigurationFactory.php
@@ -0,0 +1,111 @@
+<?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. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace DoctrineORMModule\Service;
+
+use RuntimeException;
+use Doctrine\DBAL\Configuration;
+use Doctrine\DBAL\Types\Type;
+use Zend\ServiceManager\FactoryInterface;
+use Zend\ServiceManager\ServiceLocatorInterface;
+
+/**
+ * DBAL Configuration ServiceManager factory
+ *
+ * @license MIT
+ * @link http://www.doctrine-project.org/
+ * @author Kyle Spraggs <theman@spiffyjr.me>
+ */
+class DBALConfigurationFactory implements FactoryInterface
+{
+ /**
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * @param $name
+ */
+ public function __construct($name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * {@inheritDoc}
+ * @return \Doctrine\DBAL\Configuration
+ */
+ public function createService(ServiceLocatorInterface $serviceLocator)
+ {
+ $config = new Configuration();
+ $this->setupDBALConfiguration($serviceLocator, $config);
+
+ return $config;
+ }
+
+ /**
+ * @param ServiceLocatorInterface $serviceLocator
+ * @param Configuration $config
+ */
+ public function setupDBALConfiguration(ServiceLocatorInterface $serviceLocator, Configuration $config)
+ {
+ $options = $this->getOptions($serviceLocator);
+ $config->setResultCacheImpl($serviceLocator->get($options->resultCache));
+ $config->setSQLLogger($options->sqlLogger);
+
+ foreach ($options->types as $name => $class) {
+ if (Type::hasType($name)) {
+ Type::overrideType($name, $class);
+ } else {
+ Type::addType($name, $class);
+ }
+ }
+ }
+
+ /**
+ * @param ServiceLocatorInterface $serviceLocator
+ * @return mixed
+ * @throws RuntimeException
+ */
+ public function getOptions(ServiceLocatorInterface $serviceLocator)
+ {
+ $options = $serviceLocator->get('Configuration');
+ $options = $options['doctrine'];
+ $options = isset($options['configuration'][$this->name]) ? $options['configuration'][$this->name] : null;
+
+ if (null === $options) {
+ throw new RuntimeException(sprintf(
+ 'Configuration with name "%s" could not be found in "doctrine.configuration".',
+ $this->name
+ ));
+ }
+
+ $optionsClass = $this->getOptionsClass();
+
+ return new $optionsClass($options);
+ }
+
+ /**
+ * @return string
+ */
+ protected function getOptionsClass()
+ {
+ return 'DoctrineModule\Options\Configuration';
+ }
+}
View
77 src/DoctrineORMModule/Service/DBALConnectionFactory.php
@@ -0,0 +1,77 @@
+<?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. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace DoctrineORMModule\Service;
+
+use Doctrine\DBAL\DriverManager;
+use DoctrineModule\Service\AbstractFactory;
+use Zend\ServiceManager\ServiceLocatorInterface;
+
+/**
+ * DBAL Connection ServiceManager factory
+ *
+ * @license MIT
+ * @link http://www.doctrine-project.org/
+ * @author Kyle Spraggs <theman@spiffyjr.me>
+ */
+class DBALConnectionFactory extends AbstractFactory
+{
+ /**
+ * {@inheritDoc}
+ * @return \Doctrine\DBAL\Connection
+ */
+ public function createService(ServiceLocatorInterface $sl)
+ {
+ /** @var $options \DoctrineORMModule\Options\DBALConnection */
+ $options = $this->getOptions($sl, 'connection');
+ $pdo = $options->getPdo();
+
+ if (is_string($pdo)) {
+ $pdo = $sl->get($pdo);
+ }
+
+ $params = array(
+ 'driverClass' => $options->getDriverClass(),
+ 'wrapperClass' => $options->getWrapperClass(),
+ 'pdo' => $pdo,
+ );
+ $params = array_merge($params, $options->getParams());
+
+ $configuration = $sl->get($options->getConfiguration());
+ $eventManager = $sl->get($options->getEventManager());
+
+ $connection = DriverManager::getConnection($params, $configuration, $eventManager);
+ $platform = $connection->getDatabasePlatform();
+ foreach ($options->getDoctrineTypeMappings() as $dbType => $doctrineType) {
+ $platform->registerDoctrineTypeMapping($dbType, $doctrineType);
+ }
+
+ return $connection;
+ }
+
+ /**
+ * Get the class name of the options associated with this factory.
+ *
+ * @return string
+ */
+ public function getOptionsClass()
+ {
+ return 'DoctrineORMModule\Options\DBALConnection';
+ }
+}
View
9 src/DoctrineORMModule/Service/EntityManagerFactory.php
@@ -8,8 +8,13 @@
class EntityManagerFactory extends AbstractFactory
{
+ /**
+ * {@inheritDoc}
+ * @return EntityManager
+ */
public function createService(ServiceLocatorInterface $sl)
{
+ /* @var $options \DoctrineORMModule\Options\EntityManager */
$options = $this->getOptions($sl, 'entitymanager');
$connection = $sl->get($options->getConnection());
$config = $sl->get($options->getConfiguration());
@@ -18,9 +23,7 @@ public function createService(ServiceLocatorInterface $sl)
}
/**
- * Get the class name of the options associated with this factory.
- *
- * @return string
+ * {@inheritDoc}
*/
public function getOptionsClass()
{
View
12 tests/Bootstrap.php
@@ -1,6 +1,7 @@
<?php
use Zend\ServiceManager\ServiceManager;
-use Zend\Mvc\Service\ServiceManagerConfiguration;
+use Zend\Mvc\Service\ServiceManagerConfig;
+use DoctrineORMModuleTest\Framework\TestCase;
chdir(__DIR__);
@@ -12,7 +13,7 @@
if ($previousDir === $dir) {
throw new RuntimeException(
'Unable to locate "config/application.config.php":'
- . ' is OcraDiCompiler in a sub-directory of your application skeleton?'
+ . ' is DoctrineORMModule in a sub-directory of your application skeleton?'
);
}
@@ -29,10 +30,10 @@
}
// $configuration is loaded from TestConfiguration.php (or .dist)
-$serviceManager = new ServiceManager(new ServiceManagerConfiguration(
+$serviceManager = new ServiceManager(new ServiceManagerConfig(
isset($configuration['service_manager']) ? $configuration['service_manager'] : array()
));
-$serviceManager->setService('ApplicationConfiguration', $configuration);
+$serviceManager->setService('ApplicationConfig', $configuration);
/** @var $moduleManager \Zend\ModuleManager\ModuleManager */
$moduleManager = $serviceManager->get('ModuleManager');
@@ -59,5 +60,4 @@
);
$serviceManager->setService('Configuration', $config);
-
-\DoctrineORMModuleTest\Framework\TestCase::setServiceManager($serviceManager);
+TestCase::setServiceManager($serviceManager);

0 comments on commit e5b98e9

Please sign in to comment.