Unverified Commit 3f41141b authored by Michael Raith's avatar Michael Raith Committed by Michael Moravec

SqliteSchemaManagerTest: Add tests for columns with special characters

parent 1853a6dd
...@@ -36,6 +36,14 @@ class SqliteSchemaManagerTest extends \PHPUnit\Framework\TestCase ...@@ -36,6 +36,14 @@ class SqliteSchemaManagerTest extends \PHPUnit\Framework\TestCase
['BINARY', 'b', 'CREATE TABLE "a" (bb TEXT COLLATE RTRIM, b VARCHAR(42) NOT NULL COLLATE BINARY)'], ['BINARY', 'b', 'CREATE TABLE "a" (bb TEXT COLLATE RTRIM, b VARCHAR(42) NOT NULL COLLATE BINARY)'],
['BINARY', 'b', 'CREATE TABLE "a" (bbb TEXT COLLATE NOCASE, bb TEXT COLLATE RTRIM, b VARCHAR(42) NOT NULL COLLATE BINARY)'], ['BINARY', 'b', 'CREATE TABLE "a" (bbb TEXT COLLATE NOCASE, bb TEXT COLLATE RTRIM, b VARCHAR(42) NOT NULL COLLATE BINARY)'],
['BINARY', 'b', 'CREATE TABLE "a" (b VARCHAR(42) NOT NULL COLLATE BINARY, bb TEXT COLLATE RTRIM)'], ['BINARY', 'b', 'CREATE TABLE "a" (b VARCHAR(42) NOT NULL COLLATE BINARY, bb TEXT COLLATE RTRIM)'],
['utf-8', 'bar#', 'CREATE TABLE dummy_table (id INTEGER NOT NULL, foo VARCHAR(255) COLLATE "utf-8" NOT NULL, "bar#" VARCHAR(255) COLLATE "utf-8" NOT NULL, baz VARCHAR(255) COLLATE "utf-8" NOT NULL, PRIMARY KEY(id))'],
[null, 'bar#', 'CREATE TABLE dummy_table (id INTEGER NOT NULL, foo VARCHAR(255) NOT NULL, "bar#" VARCHAR(255) NOT NULL, baz VARCHAR(255) NOT NULL, PRIMARY KEY(id))'],
['utf-8', 'baz', 'CREATE TABLE dummy_table (id INTEGER NOT NULL, foo VARCHAR(255) COLLATE "utf-8" NOT NULL, "bar#" INTEGER NOT NULL, baz VARCHAR(255) COLLATE "utf-8" NOT NULL, PRIMARY KEY(id))'],
[null, 'baz', 'CREATE TABLE dummy_table (id INTEGER NOT NULL, foo VARCHAR(255) NOT NULL, "bar#" INTEGER NOT NULL, baz VARCHAR(255) NOT NULL, PRIMARY KEY(id))'],
['utf-8', 'bar/', 'CREATE TABLE dummy_table (id INTEGER NOT NULL, foo VARCHAR(255) COLLATE "utf-8" NOT NULL, "bar/" VARCHAR(255) COLLATE "utf-8" NOT NULL, baz VARCHAR(255) COLLATE "utf-8" NOT NULL, PRIMARY KEY(id))'],
[null, 'bar/', 'CREATE TABLE dummy_table (id INTEGER NOT NULL, foo VARCHAR(255) NOT NULL, "bar/" VARCHAR(255) NOT NULL, baz VARCHAR(255) NOT NULL, PRIMARY KEY(id))'],
['utf-8', 'baz', 'CREATE TABLE dummy_table (id INTEGER NOT NULL, foo VARCHAR(255) COLLATE "utf-8" NOT NULL, "bar/" INTEGER NOT NULL, baz VARCHAR(255) COLLATE "utf-8" NOT NULL, PRIMARY KEY(id))'],
[null, 'baz', 'CREATE TABLE dummy_table (id INTEGER NOT NULL, foo VARCHAR(255) NOT NULL, "bar/" INTEGER NOT NULL, baz VARCHAR(255) NOT NULL, PRIMARY KEY(id))'],
]; ];
} }
...@@ -97,6 +105,148 @@ class SqliteSchemaManagerTest extends \PHPUnit\Framework\TestCase ...@@ -97,6 +105,148 @@ class SqliteSchemaManagerTest extends \PHPUnit\Framework\TestCase
, "c" CHAR(36) NOT NULL --(DC2Type:guid) , "c" CHAR(36) NOT NULL --(DC2Type:guid)
)', )',
], ],
'Column with numeric but no comment 4' => [
'(DC2Type:array)',
'b',
'CREATE TABLE "b" ("a" NUMERIC(10, 0) NOT NULL,
"b" CLOB NOT NULL, --(DC2Type:array)
"c" CHAR(36) NOT NULL --(DC2Type:guid)
)',
],
'Column "bar", select "bar" with no comment' => [
null,
'bar',
'CREATE TABLE dummy_table (
id INTEGER NOT NULL,
foo VARCHAR(255) COLLATE "utf-8" NOT NULL,
"bar" VARCHAR(255) COLLATE "utf-8" NOT NULL,
baz VARCHAR(255) COLLATE "utf-8" NOT NULL,
PRIMARY KEY(id)
)',
],
'Column "bar", select "bar" with type comment' => [
'(DC2Type:x)',
'bar',
'CREATE TABLE dummy_table (
id INTEGER NOT NULL,
foo VARCHAR(255) COLLATE "utf-8" NOT NULL,
"bar" VARCHAR(255) COLLATE "utf-8" NOT NULL, --(DC2Type:x)
baz VARCHAR(255) COLLATE "utf-8" NOT NULL, --(DC2Type:y)
PRIMARY KEY(id)
)',
],
'Column "bar", select "baz" with no comment' => [
null,
'baz',
'CREATE TABLE dummy_table (
id INTEGER NOT NULL,
foo VARCHAR(255) COLLATE "utf-8" NOT NULL,
"bar" INTEGER NOT NULL,
baz VARCHAR(255) COLLATE "utf-8" NOT NULL,
PRIMARY KEY(id)
)',
],
'Column "bar", select "baz" with type comment' => [
'(DC2Type:y)',
'baz',
'CREATE TABLE dummy_table (
id INTEGER NOT NULL,
foo VARCHAR(255) COLLATE "utf-8" NOT NULL,
"bar" INTEGER NOT NULL, --(DC2Type:x)
baz VARCHAR(255) COLLATE "utf-8" NOT NULL, --(DC2Type:y)
PRIMARY KEY(id)
)',
],
'Column "bar#", select "bar#" with no comment' => [
null,
'bar#',
'CREATE TABLE dummy_table (
id INTEGER NOT NULL,
foo VARCHAR(255) COLLATE "utf-8" NOT NULL,
"bar#" VARCHAR(255) COLLATE "utf-8" NOT NULL,
baz VARCHAR(255) COLLATE "utf-8" NOT NULL,
PRIMARY KEY(id)
)',
],
'Column "bar#", select "bar#" with type comment' => [
'(DC2Type:x)',
'bar#',
'CREATE TABLE dummy_table (
id INTEGER NOT NULL,
foo VARCHAR(255) COLLATE "utf-8" NOT NULL,
"bar#" VARCHAR(255) COLLATE "utf-8" NOT NULL, --(DC2Type:x)
baz VARCHAR(255) COLLATE "utf-8" NOT NULL, --(DC2Type:y)
PRIMARY KEY(id)
)',
],
'Column "bar#", select "baz" with no comment' => [
null,
'baz',
'CREATE TABLE dummy_table (
id INTEGER NOT NULL,
foo VARCHAR(255) COLLATE "utf-8" NOT NULL,
"bar#" INTEGER NOT NULL,
baz VARCHAR(255) COLLATE "utf-8" NOT NULL,
PRIMARY KEY(id)
)',
],
'Column "bar#", select "baz" with type comment' => [
'(DC2Type:y)',
'baz',
'CREATE TABLE dummy_table (
id INTEGER NOT NULL,
foo VARCHAR(255) COLLATE "utf-8" NOT NULL,
"bar#" INTEGER NOT NULL, --(DC2Type:x)
baz VARCHAR(255) COLLATE "utf-8" NOT NULL, --(DC2Type:y)
PRIMARY KEY(id)
)',
],
'Column "bar/", select "bar/" with no comment' => [
null,
'bar/',
'CREATE TABLE dummy_table (
id INTEGER NOT NULL,
foo VARCHAR(255) COLLATE "utf-8" NOT NULL,
"bar/" VARCHAR(255) COLLATE "utf-8" NOT NULL,
baz VARCHAR(255) COLLATE "utf-8" NOT NULL,
PRIMARY KEY(id)
)',
],
'Column "bar/", select "bar/" with type comment' => [
'(DC2Type:x)',
'bar/',
'CREATE TABLE dummy_table (
id INTEGER NOT NULL,
foo VARCHAR(255) COLLATE "utf-8" NOT NULL,
"bar/" VARCHAR(255) COLLATE "utf-8" NOT NULL, --(DC2Type:x)
baz VARCHAR(255) COLLATE "utf-8" NOT NULL, --(DC2Type:y)
PRIMARY KEY(id)
)',
],
'Column "bar/", select "baz" with no comment' => [
null,
'baz',
'CREATE TABLE dummy_table (
id INTEGER NOT NULL,
foo VARCHAR(255) COLLATE "utf-8" NOT NULL,
"bar/" INTEGER NOT NULL,
baz VARCHAR(255) COLLATE "utf-8" NOT NULL,
PRIMARY KEY(id)
)',
],
'Column "bar/", select "baz" with type comment' => [
'(DC2Type:y)',
'baz',
'CREATE TABLE dummy_table (
id INTEGER NOT NULL,
foo VARCHAR(255) COLLATE "utf-8" NOT NULL,
"bar/" INTEGER COLLATE "utf-8" NOT NULL, --(DC2Type:x)
baz VARCHAR(255) COLLATE "utf-8" NOT NULL, --(DC2Type:y)
PRIMARY KEY(id)
)',
],
]; ];
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment