public function setUp() { parent::setUp(); /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ $sm = $this->_conn->getSchemaManager(); $table = new \Doctrine\DBAL\Schema\Table("type_conversion"); $table->addColumn('id', 'integer', array('notnull' => false)); $table->addColumn('test_string', 'string', array('notnull' => false)); $table->addColumn('test_boolean', 'boolean', array('notnull' => false)); $table->addColumn('test_bigint', 'bigint', array('notnull' => false)); $table->addColumn('test_smallint', 'bigint', array('notnull' => false)); $table->addColumn('test_datetime', 'datetime', array('notnull' => false)); $table->addColumn('test_datetimetz', 'datetimetz', array('notnull' => false)); $table->addColumn('test_date', 'date', array('notnull' => false)); $table->addColumn('test_time', 'time', array('notnull' => false)); $table->addColumn('test_text', 'text', array('notnull' => false)); $table->addColumn('test_array', 'array', array('notnull' => false)); $table->addColumn('test_object', 'object', array('notnull' => false)); $table->addColumn('test_float', 'float', array('notnull' => false)); $table->addColumn('test_decimal', 'decimal', array('notnull' => false, 'scale' => 2, 'precision' => 10)); $table->setPrimaryKey(array('id')); try { foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) as $sql) { $this->_conn->executeQuery($sql); } } catch (\Exception $e) { } }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); if (!GeometryEngineRegistry::has()) { $this->markTestSkipped('This test requires a connection to a database.'); } $engine = GeometryEngineRegistry::get(); if (!$engine instanceof PDOEngine) { $this->markTestSkipped('This test currently only works with a PDO connection.'); } $this->platform = $this->_conn->getDatabasePlatform(); $this->platform->registerDoctrineTypeMapping('geometry', 'binary'); $this->platform->registerDoctrineTypeMapping('linestring', 'binary'); $this->platform->registerDoctrineTypeMapping('multilinestring', 'binary'); $this->platform->registerDoctrineTypeMapping('multipoint', 'binary'); $this->platform->registerDoctrineTypeMapping('multipolygon', 'binary'); $this->platform->registerDoctrineTypeMapping('point', 'binary'); $this->platform->registerDoctrineTypeMapping('polygon', 'binary'); switch ($this->platform->getName()) { case 'postgresql': $this->_conn->executeQuery('CREATE EXTENSION IF NOT EXISTS postgis;'); break; } $this->fixtureLoader = new Loader(); $config = Setup::createAnnotationMetadataConfiguration([__DIR__ . '/Fixtures'], false); $config->addCustomNumericFunction('EarthDistance', EarthDistanceFunction::class); $this->em = EntityManager::create($this->_conn, $config, $this->platform->getEventManager()); $this->schemaTool = new SchemaTool($this->em); $this->schemaTool->updateSchema([$this->em->getClassMetadata(Fixtures\GeometryEntity::class), $this->em->getClassMetadata(Fixtures\LineStringEntity::class), $this->em->getClassMetadata(Fixtures\MultiLineStringEntity::class), $this->em->getClassMetadata(Fixtures\MultiPointEntity::class), $this->em->getClassMetadata(Fixtures\MultiPolygonEntity::class), $this->em->getClassMetadata(Fixtures\PointEntity::class), $this->em->getClassMetadata(Fixtures\PolygonEntity::class)]); $purger = new ORMPurger(); $this->ormExecutor = new ORMExecutor($this->em, $purger); }
protected function setUp() { parent::setUp(); if (!$this->_conn->getDriver() instanceof ExceptionConverterDriver) { $this->markTestSkipped('Driver does not support special exception handling.'); } }
public function setUp() { parent::setUp(); /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ $sm = $this->_conn->getSchemaManager(); if (!$sm->tablesExist(array('type_conversion'))) { $table = new \Doctrine\DBAL\Schema\Table("type_conversion"); $table->addColumn('id', 'integer', array('notnull' => false)); $table->addColumn('test_string', 'string', array('notnull' => false)); $table->addColumn('test_boolean', 'boolean', array('notnull' => false)); $table->addColumn('test_bigint', 'bigint', array('notnull' => false)); $table->addColumn('test_smallint', 'bigint', array('notnull' => false)); $table->addColumn('test_datetime', 'datetime', array('notnull' => false)); $table->addColumn('test_datetimetz', 'datetimetz', array('notnull' => false)); $table->addColumn('test_date', 'date', array('notnull' => false)); $table->addColumn('test_time', 'time', array('notnull' => false)); $table->addColumn('test_text', 'text', array('notnull' => false)); $table->addColumn('test_array', 'array', array('notnull' => false)); $table->addColumn('test_object', 'object', array('notnull' => false)); $table->addColumn('test_float', 'float', array('notnull' => false)); $table->addColumn('test_decimal', 'decimal', array('notnull' => false, 'scale' => 2, 'precision' => 10)); $table->setPrimaryKey(array('id')); $sm->createTable($table); } }
public function setUp() { parent::setUp(); if ($this->_conn->getDatabasePlatform()->getName() !== "postgresql") { $this->markTestSkipped('PostgreSQL Only test'); } }
public function setUp() { parent::setUp(); if ($this->_conn->getDatabasePlatform()->getName() != 'informix') { $this->markTestSkipped('This test only applies to PDO_INFORMIX'); } $this->connection = $this->_conn->getWrappedConnection(); }
public function setUp() { parent::setUp(); try { $this->_conn->exec($this->_conn->getDatabasePlatform()->getDropTableSQL("nontemporary")); } catch (\Exception $e) { } }
protected function setUp() { parent::setUp(); $platform = $this->_conn->getDatabasePlatform()->getName(); if (!in_array($platform, array('mysql', 'sqlite'))) { $this->markTestSkipped('Currently restricted to MySQL and SQLite.'); } }
protected function setUp() { parent::setUp(); $platform = $this->_conn->getDatabasePlatform()->getName(); if (!in_array($platform, array('sqlite'))) { $this->markTestSkipped('Related to SQLite only'); } }
protected function setUp() { parent::setUp(); $dbms = $this->getPlatformName(); if ($this->_conn->getDatabasePlatform()->getName() !== $dbms) { $this->markTestSkipped(get_class($this) . ' requires the use of ' . $dbms); } $this->_sm = $this->_conn->getSchemaManager(); }
public function setUp() { if (!extension_loaded('mysqli')) { $this->markTestSkipped('mysqli is not installed.'); } parent::setUp(); if (!$this->_conn->getDriver() instanceof \Doctrine\DBAL\Driver\Mysqli\Driver) { $this->markTestSkipped('MySQLi only test.'); } }
protected function setUp() { if (!extension_loaded('PDO')) { $this->markTestSkipped('PDO is not installed.'); } parent::setUp(); $this->driverConnection = $this->_conn->getWrappedConnection(); if (!$this->driverConnection instanceof PDOConnection) { $this->markTestSkipped('PDO connection only test.'); } }
protected function setUp() { parent::setUp(); $class = get_class($this); $e = explode('\\', $class); $testClass = end($e); $dbms = strtolower(str_replace('SchemaManagerTest', null, $testClass)); if ($this->_conn->getDatabasePlatform()->getName() !== $dbms) { $this->markTestSkipped('The ' . $testClass . ' requires the use of ' . $dbms); } $this->_sm = $this->_conn->getSchemaManager(); }
public function setUp() { parent::setUp(); try { /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ $table = new \Doctrine\DBAL\Schema\Table("fetch_table"); $table->addColumn('test_int', 'integer'); $table->addColumn('test_string', 'string'); $sm = $this->_conn->getSchemaManager(); $sm->createTable($table); $this->_conn->insert('fetch_table', array('test_int' => 1, 'test_string' => 'foo')); } catch (\Exception $e) { } }
public function setUp() { parent::setUp(); try { /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ $table = new \Doctrine\DBAL\Schema\Table("write_table"); $table->addColumn('test_int', 'integer'); $table->addColumn('test_string', 'string', array('notnull' => false)); $sm = $this->_conn->getSchemaManager(); $sm->createTable($table); } catch (\Exception $e) { } $this->_conn->executeUpdate('DELETE FROM write_table'); }
protected function setUp() { parent::setUp(); $platform = $this->_conn->getDatabasePlatform()->getName(); if (!in_array($platform, array('postgresql'))) { $this->markTestSkipped('Currently restricted to PostgreSQL'); } try { $this->_conn->exec('CREATE TABLE dbal630 (id SERIAL, bool_col BOOLEAN NOT NULL);'); $this->_conn->exec('CREATE TABLE dbal630_allow_nulls (id SERIAL, bool_col BOOLEAN);'); } catch (DBALException $e) { } $this->running = true; }
protected function setUp() { parent::setUp(); if ($this->_conn->getDatabasePlatform()->getName() != 'oracle') { $this->markTestSkipped('OCI8 only test'); } if ($this->_conn->getSchemaManager()->tablesExist('DBAL202')) { $this->_conn->executeQuery('DELETE FROM DBAL202'); } else { $table = new \Doctrine\DBAL\Schema\Table('DBAL202'); $table->addColumn('id', 'integer'); $table->setPrimaryKey(array('id')); $this->_conn->getSchemaManager()->createTable($table); } }
public function setUp() { parent::setUp(); try { /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ $table = new \Doctrine\DBAL\Schema\Table("write_table"); $table->addColumn('test_int', 'integer'); $table->addColumn('test_string', 'string', array('notnull' => false)); $table->setPrimaryKey(array('test_int')); foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) as $sql) { $this->_conn->executeQuery($sql); } } catch (\Exception $e) { } $this->_conn->executeUpdate('DELETE FROM write_table'); }
public function setUp() { parent::setUp(); if (self::$generated === false) { /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ $table = new \Doctrine\DBAL\Schema\Table("fetch_table"); $table->addColumn('test_int', 'integer'); $table->addColumn('test_string', 'string'); $table->addColumn('test_datetime', 'datetime', array('notnull' => false)); $table->setPrimaryKey(array('test_int')); $sm = $this->_conn->getSchemaManager(); $sm->createTable($table); $this->_conn->insert('fetch_table', array('test_int' => 1, 'test_string' => 'foo', 'test_datetime' => '2010-01-01 10:10:10')); self::$generated = true; } }
public function setUp() { parent::setUp(); try { /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ $table = new \Doctrine\DBAL\Schema\Table("blob_table"); $table->addColumn('id', 'integer'); $table->addColumn('clobfield', 'text'); $table->addColumn('blobfield', 'blob'); $table->setPrimaryKey(array('id')); $sm = $this->_conn->getSchemaManager(); $sm->createTable($table); } catch (\Exception $e) { } $this->_conn->exec($this->_conn->getDatabasePlatform()->getTruncateTableSQL('blob_table')); }
public function setUp() { parent::setUp(); if ($this->_conn->getDatabasePlatform()->getName() == "sqlite") { $this->markTestSkipped('Test does not work on sqlite.'); } try { /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ $table = new \Doctrine\DBAL\Schema\Table("master_slave_table"); $table->addColumn('test_int', 'integer'); $table->setPrimaryKey(array('test_int')); $sm = $this->_conn->getSchemaManager(); $sm->createTable($table); $this->_conn->insert('master_slave_table', array('test_int' => 1)); } catch (\Exception $e) { } }
public function setUp() { parent::setUp(); if (!self::$tableCreated) { /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ $table = new \Doctrine\DBAL\Schema\Table("modify_limit_table"); $table->addColumn('test_int', 'integer'); $table2 = new \Doctrine\DBAL\Schema\Table("modify_limit_table2"); $table2->addColumn('test_int', 'integer'); $sm = $this->_conn->getSchemaManager(); $sm->createTable($table); $sm->createTable($table2); self::$tableCreated = true; } $this->_conn->exec($this->_conn->getDatabasePlatform()->getTruncateTableSQL('modify_limit_table')); $this->_conn->exec($this->_conn->getDatabasePlatform()->getTruncateTableSQL('modify_limit_table2')); }
public function setUp() { parent::setUp(); $platform = $this->_conn->getDatabasePlatform(); if ($platform->getName() == "sqlite") { $this->markTestSkipped('TableGenerator does not work with SQLite'); } try { $schema = new \Doctrine\DBAL\Schema\Schema(); $visitor = new \Doctrine\DBAL\Id\TableGeneratorSchemaVisitor(); $schema->visit($visitor); foreach ($schema->toSql($platform) as $sql) { $this->_conn->exec($sql); } } catch (\Exception $e) { } $this->generator = new TableGenerator($this->_conn); }
public function setUp() { parent::setUp(); $platformName = $this->_conn->getDatabasePlatform()->getName(); // This is a MySQL specific test, skip other vendors. if ($platformName != 'mysql') { $this->markTestSkipped(sprintf('Test does not work on %s.', $platformName)); } try { /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ $table = new \Doctrine\DBAL\Schema\Table("master_slave_table"); $table->addColumn('test_int', 'integer'); $table->setPrimaryKey(array('test_int')); $sm = $this->_conn->getSchemaManager(); $sm->createTable($table); } catch (\Exception $e) { } $this->_conn->executeUpdate('DELETE FROM master_slave_table'); $this->_conn->insert('master_slave_table', array('test_int' => 1)); }
protected function setUp() { parent::setUp(); if ($this->_conn->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlsrv\Driver) { $this->markTestSkipped('This test does not work on pdo_sqlsrv driver due to a bug. See: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/5a755bdd-41e9-45cb-9166-c9da4475bb94/how-to-set-null-for-varbinarymax-using-bindvalue-using-pdosqlsrv?forum=sqldriverforphp'); } try { /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ $table = new \Doctrine\DBAL\Schema\Table("blob_table"); $table->addColumn('id', 'integer'); $table->addColumn('clobfield', 'text'); $table->addColumn('blobfield', 'blob'); $table->addColumn('binaryfield', 'binary', array('length' => 50)); $table->setPrimaryKey(array('id')); $sm = $this->_conn->getSchemaManager(); $sm->createTable($table); } catch (\Exception $e) { } $this->_conn->exec($this->_conn->getDatabasePlatform()->getTruncateTableSQL('blob_table')); }
public function setUp() { parent::setUp(); try { /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ $table = new \Doctrine\DBAL\Schema\Table("caching"); $table->addColumn('test_int', 'integer'); $table->addColumn('test_string', 'string', array('notnull' => false)); $table->setPrimaryKey(array('test_int')); $sm = $this->_conn->getSchemaManager(); $sm->createTable($table); } catch (\Exception $e) { } $this->_conn->executeUpdate('DELETE FROM caching'); foreach ($this->expectedResult as $row) { $this->_conn->insert('caching', $row); } $config = $this->_conn->getConfiguration(); $config->setSQLLogger($this->sqlLogger = new \Doctrine\DBAL\Logging\DebugStack()); $cache = new \Doctrine\Common\Cache\ArrayCache(); $config->setResultCacheImpl($cache); }
public function setUp() { parent::setUp(); if (!$this->_conn->getSchemaManager()->tablesExist("ddc1372_foobar")) { try { $table = new \Doctrine\DBAL\Schema\Table("ddc1372_foobar"); $table->addColumn('id', 'integer'); $table->addColumn('foo', 'string'); $table->addColumn('bar', 'string'); $table->setPrimaryKey(array('id')); $sm = $this->_conn->getSchemaManager(); $sm->createTable($table); $this->_conn->insert('ddc1372_foobar', array('id' => 1, 'foo' => 1, 'bar' => 1)); $this->_conn->insert('ddc1372_foobar', array('id' => 2, 'foo' => 1, 'bar' => 2)); $this->_conn->insert('ddc1372_foobar', array('id' => 3, 'foo' => 1, 'bar' => 3)); $this->_conn->insert('ddc1372_foobar', array('id' => 4, 'foo' => 1, 'bar' => 4)); $this->_conn->insert('ddc1372_foobar', array('id' => 5, 'foo' => 2, 'bar' => 1)); $this->_conn->insert('ddc1372_foobar', array('id' => 6, 'foo' => 2, 'bar' => 2)); } catch (\Exception $e) { $this->fail($e->getMessage()); } } }
protected function setUp() { parent::setUp(); $this->driver = $this->createDriver(); }
protected function setUp() { $this->resetSharedConn(); parent::setUp(); }
public function setUp() { $this->resetSharedConn(); parent::setUp(); }