Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
ab3821c7
Unverified
Commit
ab3821c7
authored
Sep 16, 2017
by
Gawain Lynch
Committed by
Luís Cobucci
Nov 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Tests] Permutations for Sqlite column comment detection
parent
4f1320ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
SqliteSchemaManagerTest.php
tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php
+61
-0
No files found.
tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php
View file @
ab3821c7
...
...
@@ -38,4 +38,65 @@ class SqliteSchemaManagerTest extends \PHPUnit_Framework_TestCase
[
'BINARY'
,
'b'
,
'CREATE TABLE "a" (b VARCHAR(42) NOT NULL COLLATE BINARY, bb TEXT COLLATE RTRIM)'
],
];
}
/**
* @dataProvider getDataColumnComment
*
* @group 2865
*/
public
function
testParseColumnCommentFromSQL
(
$comment
,
string
$column
,
string
$sql
)
:
void
{
$conn
=
$this
->
createMock
(
Connection
::
class
);
$conn
->
method
(
'getDatabasePlatform'
)
->
willReturn
(
new
SqlitePlatform
());
$manager
=
new
SqliteSchemaManager
(
$conn
);
$ref
=
new
\ReflectionMethod
(
$manager
,
'parseColumnCommentFromSQL'
);
$ref
->
setAccessible
(
true
);
self
::
assertSame
(
$comment
,
$ref
->
invoke
(
$manager
,
$column
,
$sql
));
}
public
function
getDataColumnComment
()
{
return
[
'Single column with no comment'
=>
[
false
,
'a'
,
'CREATE TABLE "a" ("a" TEXT DEFAULT "a" COLLATE RTRIM)'
,
],
'Single column with type comment'
=>
[
'(DC2Type:x)'
,
'a'
,
'CREATE TABLE "a" ("a" CLOB DEFAULT NULL COLLATE BINARY --(DC2Type:x)
)'
,
],
'Multiple similar columns with type comment 1'
=>
[
false
,
'b'
,
'CREATE TABLE "a" (a TEXT COLLATE RTRIM, "b" TEXT DEFAULT "a" COLLATE RTRIM, "bb" CLOB DEFAULT NULL COLLATE BINARY --(DC2Type:x)
)'
,
],
'Multiple similar columns with type comment 2'
=>
[
'(DC2Type:x)'
,
'b'
,
'CREATE TABLE "a" (a TEXT COLLATE RTRIM, "bb" TEXT DEFAULT "a" COLLATE RTRIM, "b" CLOB DEFAULT NULL COLLATE BINARY --(DC2Type:x)
)'
,
],
'Multiple similar columns on different lines, with type comment 1'
=>
[
false
,
'bb'
,
'CREATE TABLE "a" (a TEXT COLLATE RTRIM, "b" CLOB DEFAULT NULL COLLATE BINARY --(DC2Type:x)
, "bb" TEXT DEFAULT "a" COLLATE RTRIM'
,
],
'Multiple similar columns on different lines, with type comment 2'
=>
[
'(DC2Type:x)'
,
'bb'
,
'CREATE TABLE "a" (a TEXT COLLATE RTRIM, "bb" CLOB DEFAULT NULL COLLATE BINARY --(DC2Type:x)
, "b" TEXT DEFAULT "a" COLLATE RTRIM'
,
],
'Column with numeric but no comment 1'
=>
[
false
,
'a'
,
'CREATE TABLE "a" ("a" NUMERIC(10, 0) NOT NULL, "b" CLOB NOT NULL --(DC2Type:array)
, "c" CHAR(36) NOT NULL --(DC2Type:guid)
)'
,
],
'Column with numeric but no comment 2'
=>
[
false
,
'a'
,
'CREATE TABLE "b" ("a" NUMERIC(10, 0) NOT NULL, "b" CLOB NOT NULL --(DC2Type:array)
, "c" CHAR(36) NOT NULL --(DC2Type:guid)
)'
,
],
'Column with numeric but no comment 3'
=>
[
'(DC2Type:guid)'
,
'c'
,
'CREATE TABLE "b" ("a" NUMERIC(10, 0) NOT NULL, "b" CLOB NOT NULL --(DC2Type:array)
, "c" CHAR(36) NOT NULL --(DC2Type:guid)
)'
,
],
];
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment