Since: 2.0
Author: Roman Borschel (roman@code-factory.org)
Inheritance: extends Doctrine\DBAL\Platforms\AbstractPlatform
 /**
  * @covers \EzSystems\EzSupportToolsBundle\SystemInfo\Collector\DoctrineDatabaseSystemInfoCollector::collect()
  */
 public function testCollect()
 {
     $expected = new DatabaseSystemInfo(['type' => 'mysql', 'name' => 'ezp_platform', 'host' => 'localhost', 'username' => 'ezp_user']);
     $this->dbalConnectionMock->expects($this->once())->method('getDatabasePlatform')->will($this->returnValue($this->dbalPlatformMock));
     $this->dbalPlatformMock->expects($this->once())->method('getName')->will($this->returnValue($expected->type));
     $this->dbalConnectionMock->expects($this->once())->method('getDatabase')->will($this->returnValue($expected->name));
     $this->dbalConnectionMock->expects($this->once())->method('getHost')->will($this->returnValue($expected->host));
     $this->dbalConnectionMock->expects($this->once())->method('getUsername')->will($this->returnValue($expected->username));
     $value = $this->databaseCollector->collect();
     self::assertInstanceOf('EzSystems\\EzSupportToolsBundle\\SystemInfo\\Value\\DatabaseSystemInfo', $value);
     self::assertEquals($expected, $value);
 }
Ejemplo n.º 2
0
 protected function _getCreateTableSQL($tableName, array $columns, array $options = array())
 {
     if (!isset($options['charset'])) {
         $options['charset'] = 'utf8mb4';
     }
     if (!isset($options['collate'])) {
         $options['collate'] = 'utf8mb4_unicode_ci';
     }
     return parent::_getCreateTableSQL($tableName, $columns, $options);
 }
Ejemplo n.º 3
0
 /**
  *  Use this method to add custom column type mappings 
  */
 protected function initializeDoctrineTypeMappings()
 {
     return parent::initializeDoctrineTypeMappings();
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function __construct()
 {
     parent::__construct();
     $this->registerDoctrineTypeMapping('enum', 'string');
     $this->registerDoctrineTypeMapping('set', 'string');
 }
Ejemplo n.º 5
0
 protected function _getCreateTableSQL($tableName, array $columns, array $options = array())
 {
     if (!isset($options['engine'])) {
         $options['engine'] = 'MyISAM';
     }
     return parent::_getCreateTableSQL($tableName, $columns, $options);
 }
Ejemplo n.º 6
0
 protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff)
 {
     $sql = array();
     $table = $diff->name;
     foreach ($diff->removedIndexes as $remKey => $remIndex) {
         foreach ($diff->addedIndexes as $addKey => $addIndex) {
             if ($remIndex->getColumns() == $addIndex->getColumns()) {
                 $type = '';
                 if ($addIndex->isUnique()) {
                     $type = 'UNIQUE ';
                 }
                 $query = 'ALTER TABLE ' . $this->espoQuote($table) . ' DROP INDEX ' . $remIndex->getName() . ', ';
                 $query .= 'ADD ' . $type . 'INDEX ' . $addIndex->getName();
                 $query .= ' (' . $this->getIndexFieldDeclarationListSQL($addIndex->getQuotedColumns($this)) . ')';
                 $sql[] = $query;
                 unset($diff->removedIndexes[$remKey]);
                 unset($diff->addedIndexes[$addKey]);
                 break;
             }
         }
     }
     $sql = array_merge($sql, parent::getPreAlterTableIndexForeignKeySQL($diff));
     return $sql;
 }