disable database migration unit tests for MSSQL
This commit is contained in:
parent
770f643e5c
commit
5aab98c4bf
|
@ -9,6 +9,9 @@
|
||||||
|
|
||||||
namespace Test\DB;
|
namespace Test\DB;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Platforms\OraclePlatform;
|
||||||
|
use Doctrine\DBAL\Platforms\SQLServerPlatform;
|
||||||
|
|
||||||
class MDB2SchemaManager extends \PHPUnit_Framework_TestCase {
|
class MDB2SchemaManager extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
public function tearDown() {
|
public function tearDown() {
|
||||||
|
@ -22,11 +25,14 @@ class MDB2SchemaManager extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
public function testAutoIncrement() {
|
public function testAutoIncrement() {
|
||||||
|
|
||||||
if (\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite') === 'oci') {
|
$connection = \OC_DB::getConnection();
|
||||||
|
if ($connection->getDatabasePlatform() instanceof OraclePlatform) {
|
||||||
$this->markTestSkipped('Adding auto increment columns in Oracle is not supported.');
|
$this->markTestSkipped('Adding auto increment columns in Oracle is not supported.');
|
||||||
}
|
}
|
||||||
|
if ($connection->getDatabasePlatform() instanceof SQLServerPlatform) {
|
||||||
|
$this->markTestSkipped('DB migration tests are not supported on MSSQL');
|
||||||
|
}
|
||||||
|
|
||||||
$connection = \OC_DB::getConnection();
|
|
||||||
$manager = new \OC\DB\MDB2SchemaManager($connection);
|
$manager = new \OC\DB\MDB2SchemaManager($connection);
|
||||||
|
|
||||||
$manager->createDbFromStructure(__DIR__ . '/ts-autoincrement-before.xml');
|
$manager->createDbFromStructure(__DIR__ . '/ts-autoincrement-before.xml');
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
namespace Test\DB;
|
namespace Test\DB;
|
||||||
|
|
||||||
use \Doctrine\DBAL\DBALException;
|
use \Doctrine\DBAL\DBALException;
|
||||||
|
use Doctrine\DBAL\Platforms\OraclePlatform;
|
||||||
|
use Doctrine\DBAL\Platforms\SQLServerPlatform;
|
||||||
use \Doctrine\DBAL\Schema\Schema;
|
use \Doctrine\DBAL\Schema\Schema;
|
||||||
use \Doctrine\DBAL\Schema\SchemaConfig;
|
use \Doctrine\DBAL\Schema\SchemaConfig;
|
||||||
|
|
||||||
|
@ -28,8 +30,11 @@ class Migrator extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
$this->connection = \OC_DB::getConnection();
|
$this->connection = \OC_DB::getConnection();
|
||||||
if ($this->connection->getDriver() instanceof \Doctrine\DBAL\Driver\OCI8\Driver) {
|
if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) {
|
||||||
$this->markTestSkipped('DB migration tests arent supported on OCI');
|
$this->markTestSkipped('DB migration tests are not supported on OCI');
|
||||||
|
}
|
||||||
|
if ($this->connection->getDatabasePlatform() instanceof SQLServerPlatform) {
|
||||||
|
$this->markTestSkipped('DB migration tests are not supported on MSSQL');
|
||||||
}
|
}
|
||||||
$this->manager = new \OC\DB\MDB2SchemaManager($this->connection);
|
$this->manager = new \OC\DB\MDB2SchemaManager($this->connection);
|
||||||
$this->tableName = 'test_' . uniqid();
|
$this->tableName = 'test_' . uniqid();
|
||||||
|
@ -73,7 +78,7 @@ class Migrator extends \PHPUnit_Framework_TestCase {
|
||||||
*/
|
*/
|
||||||
public function testDuplicateKeyUpgrade() {
|
public function testDuplicateKeyUpgrade() {
|
||||||
if ($this->isSQLite()) {
|
if ($this->isSQLite()) {
|
||||||
$this->markTestSkipped('sqlite doesnt throw errors when creating a new key on existing data');
|
$this->markTestSkipped('sqlite does not throw errors when creating a new key on existing data');
|
||||||
}
|
}
|
||||||
list($startSchema, $endSchema) = $this->getDuplicateKeySchemas();
|
list($startSchema, $endSchema) = $this->getDuplicateKeySchemas();
|
||||||
$migrator = $this->manager->getMigrator();
|
$migrator = $this->manager->getMigrator();
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
|
* Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
|
||||||
* This file is licensed under the Affero General Public License version 3 or
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
|
@ -6,6 +7,8 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use OCP\Security\ISecureRandom;
|
||||||
|
|
||||||
class Test_DBSchema extends PHPUnit_Framework_TestCase {
|
class Test_DBSchema extends PHPUnit_Framework_TestCase {
|
||||||
protected $schema_file = 'static://test_db_scheme';
|
protected $schema_file = 'static://test_db_scheme';
|
||||||
protected $schema_file2 = 'static://test_db_scheme2';
|
protected $schema_file2 = 'static://test_db_scheme2';
|
||||||
|
@ -16,7 +19,8 @@ class Test_DBSchema extends PHPUnit_Framework_TestCase {
|
||||||
$dbfile = OC::$SERVERROOT.'/tests/data/db_structure.xml';
|
$dbfile = OC::$SERVERROOT.'/tests/data/db_structure.xml';
|
||||||
$dbfile2 = OC::$SERVERROOT.'/tests/data/db_structure2.xml';
|
$dbfile2 = OC::$SERVERROOT.'/tests/data/db_structure2.xml';
|
||||||
|
|
||||||
$r = '_'.OC_Util::generateRandomBytes(4).'_';
|
$r = '_' . \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->
|
||||||
|
generate(4, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS) . '_';
|
||||||
$content = file_get_contents( $dbfile );
|
$content = file_get_contents( $dbfile );
|
||||||
$content = str_replace( '*dbprefix*', '*dbprefix*'.$r, $content );
|
$content = str_replace( '*dbprefix*', '*dbprefix*'.$r, $content );
|
||||||
file_put_contents( $this->schema_file, $content );
|
file_put_contents( $this->schema_file, $content );
|
||||||
|
@ -38,6 +42,10 @@ class Test_DBSchema extends PHPUnit_Framework_TestCase {
|
||||||
* @medium
|
* @medium
|
||||||
*/
|
*/
|
||||||
public function testSchema() {
|
public function testSchema() {
|
||||||
|
$platform = \OC_DB::getConnection()->getDatabasePlatform();
|
||||||
|
if ($platform instanceof \Doctrine\DBAL\Platforms\SQLServerPlatform) {
|
||||||
|
$this->markTestSkipped("Test not relevant on MSSQL");
|
||||||
|
}
|
||||||
$this->doTestSchemaCreating();
|
$this->doTestSchemaCreating();
|
||||||
$this->doTestSchemaChanging();
|
$this->doTestSchemaChanging();
|
||||||
$this->doTestSchemaDumping();
|
$this->doTestSchemaDumping();
|
||||||
|
@ -80,8 +88,8 @@ class Test_DBSchema extends PHPUnit_Framework_TestCase {
|
||||||
* @param string $table
|
* @param string $table
|
||||||
*/
|
*/
|
||||||
public function assertTableNotExist($table) {
|
public function assertTableNotExist($table) {
|
||||||
$type=OC_Config::getValue( "dbtype", "sqlite" );
|
$platform = \OC_DB::getConnection()->getDatabasePlatform();
|
||||||
if( $type == 'sqlite' || $type == 'sqlite3' ) {
|
if ($platform instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
|
||||||
// sqlite removes the tables after closing the DB
|
// sqlite removes the tables after closing the DB
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue