aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-04-14 14:11:06 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2021-04-16 09:57:27 +0200
commite88bad4b0a02dbbd5d77518d3b73ff870a1cef95 (patch)
tree00c4ec1dff99724ce47783c89b4b1b2690a358ea /tests
parent657ee534a8d0aac88472fc6b03b3e8b81572e5a7 (diff)
downloadnextcloud-server-e88bad4b0a02dbbd5d77518d3b73ff870a1cef95.tar.gz
nextcloud-server-e88bad4b0a02dbbd5d77518d3b73ff870a1cef95.zip
Run migrator tests on OCI
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/DB/MigratorTest.php36
1 files changed, 33 insertions, 3 deletions
diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php
index 1d2afaa405e..b2d1f136316 100644
--- a/tests/lib/DB/MigratorTest.php
+++ b/tests/lib/DB/MigratorTest.php
@@ -10,6 +10,7 @@
namespace Test\DB;
use Doctrine\DBAL\Exception;
+use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
@@ -21,6 +22,7 @@ use OC\DB\MySQLMigrator;
use OC\DB\OracleMigrator;
use OC\DB\PostgreSqlMigrator;
use OC\DB\SQLiteMigrator;
+use OCP\DB\Types;
use OCP\IConfig;
/**
@@ -52,9 +54,6 @@ class MigratorTest extends \Test\TestCase {
$this->config = \OC::$server->getConfig();
$this->connection = \OC::$server->get(\OC\DB\Connection::class);
- if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) {
- $this->markTestSkipped('DB migration tests are not supported on OCI');
- }
$this->tableName = $this->getUniqueTableName();
$this->tableNameTmp = $this->getUniqueTableName();
@@ -257,4 +256,35 @@ class MigratorTest extends \Test\TestCase {
$this->assertTrue($startSchema->getTable($this->tableNameTmp)->hasForeignKey($fkName));
}
+
+ public function testNotNullBoolean() {
+ $startSchema = new Schema([], [], $this->getSchemaConfig());
+ $table = $startSchema->createTable($this->tableName);
+ $table->addColumn('id', Types::BIGINT);
+ $table->addColumn('will_it_blend', Types::BOOLEAN, [
+ 'notnull' => true,
+ ]);
+ $table->addIndex(['id'], $this->tableName . '_id');
+
+ $migrator = $this->getMigrator();
+ $migrator->migrate($startSchema);
+
+ $this->connection->insert(
+ $this->tableName,
+ ['id' => 1, 'will_it_blend' => true],
+ ['id' => ParameterType::INTEGER, 'will_it_blend' => ParameterType::BOOLEAN],
+ );
+ $this->connection->insert(
+ $this->tableName,
+ ['id' => 2, 'will_it_blend' => false],
+ ['id' => ParameterType::INTEGER, 'will_it_blend' => ParameterType::BOOLEAN],
+ );
+ $this->connection->insert(
+ $this->tableName,
+ ['id' => 3, 'will_it_blend' => true],
+ ['id' => ParameterType::INTEGER, 'will_it_blend' => ParameterType::BOOLEAN],
+ );
+
+ $this->addToAssertionCount(1);
+ }
}