/** * @expectedException \Doctrine\DBAL\DBALException */ public function testThrowsExceptionOnCreatingDatabasePlatformsForInvalidVersion() { if (!$this->driver instanceof VersionAwarePlatformDriver) { $this->markTestSkipped('This test is only intended for version aware platform drivers.'); } $this->driver->createDatabasePlatformForVersion('foo'); }
/** * Detects and sets the database platform. * * Evaluates custom platform class and version in order to set the correct platform. * * @throws DBALException if an invalid platform was specified for this connection. */ private function detectDatabasePlatform() { if (!isset($this->_params['platform'])) { $version = $this->getDatabasePlatformVersion(); if (null !== $version) { $this->platform = $this->_driver->createDatabasePlatformForVersion($version); } else { $this->platform = $this->_driver->getDatabasePlatform(); } } elseif ($this->_params['platform'] instanceof Platforms\AbstractPlatform) { $this->platform = $this->_params['platform']; } else { throw DBALException::invalidPlatformSpecified(); } $this->platform->setEventManager($this->_eventManager); }