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
068617eb
Commit
068617eb
authored
Dec 25, 2014
by
Claudio Zizza
Committed by
Steve Müller
Dec 26, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unittest adapted for all plattforms using AbstractPlatformTestCase
parent
bb4f632a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
99 additions
and
21 deletions
+99
-21
AbstractMySQLPlatformTestCase.php
...ne/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php
+10
-0
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+31
-0
AbstractPostgreSqlPlatformTestCase.php
...sts/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
+3
-21
AbstractSQLServerPlatformTestCase.php
...ests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php
+10
-0
DB2PlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php
+11
-0
OraclePlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
+10
-0
SQLAnywherePlatformTest.php
...Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
+10
-0
SqlitePlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php
+14
-0
No files found.
tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php
View file @
068617eb
...
...
@@ -657,4 +657,14 @@ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase
{
return
'INDEX `select` (foo)'
;
}
/**
* {@inheritdoc}
*/
protected
function
getAlterStringToFixedStringSQL
()
{
return
array
(
'ALTER TABLE mytable CHANGE name name CHAR(2) NOT NULL'
,
);
}
}
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
068617eb
...
...
@@ -1128,4 +1128,35 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
* @return array
*/
abstract
protected
function
getQuotesTableIdentifiersInAlterTableSQL
();
/**
* @group DBAL-1090
*/
public
function
testAlterStringToFixedString
()
{
$table
=
new
Table
(
'mytable'
);
$table
->
addColumn
(
'name'
,
'string'
,
array
(
'length'
=>
2
));
$tableDiff
=
new
TableDiff
(
'mytable'
);
$tableDiff
->
fromTable
=
$table
;
$tableDiff
->
changedColumns
[
'name'
]
=
new
\Doctrine\DBAL\Schema\ColumnDiff
(
'name'
,
new
\Doctrine\DBAL\Schema\Column
(
'name'
,
\Doctrine\DBAL\Types\Type
::
getType
(
'string'
),
array
(
'fixed'
=>
true
,
'length'
=>
2
)
),
array
(
'fixed'
)
);
$sql
=
$this
->
_platform
->
getAlterTableSQL
(
$tableDiff
);
$expectedSql
=
$this
->
getAlterStringToFixedStringSQL
();
$this
->
assertEquals
(
$expectedSql
,
$sql
);
}
/**
* @return array
*/
abstract
protected
function
getAlterStringToFixedStringSQL
();
}
tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
View file @
068617eb
...
...
@@ -757,30 +757,12 @@ abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCa
}
/**
*
@group DBAL-1090
*
{@inheritdoc}
*/
p
ublic
function
testAlterStringToFixedString
()
p
rotected
function
getAlterStringToFixedStringSQL
()
{
$table
=
new
Table
(
'mytable'
);
$table
->
addColumn
(
'name'
,
'string'
,
array
(
'length'
=>
2
));
$tableDiff
=
new
TableDiff
(
'mytable'
);
$tableDiff
->
fromTable
=
$table
;
$tableDiff
->
changedColumns
[
'dloo1'
]
=
new
\Doctrine\DBAL\Schema\ColumnDiff
(
'name'
,
new
\Doctrine\DBAL\Schema\Column
(
'name'
,
\Doctrine\DBAL\Types\Type
::
getType
(
'string'
),
array
(
'fixed'
=>
true
,
'length'
=>
2
)
),
array
(
'fixed'
)
);
$sql
=
$this
->
_platform
->
getAlterTableSQL
(
$tableDiff
);
$expectedSql
=
array
(
return
array
(
'ALTER TABLE mytable ALTER name TYPE CHAR(2)'
,
);
$this
->
assertEquals
(
$expectedSql
,
$sql
);
}
}
tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php
View file @
068617eb
...
...
@@ -1202,4 +1202,14 @@ abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCas
{
return
'INDEX [select] (foo)'
;
}
/**
* {@inheritdoc}
*/
protected
function
getAlterStringToFixedStringSQL
()
{
return
array
(
'ALTER TABLE mytable ALTER COLUMN name NCHAR(2) NOT NULL'
,
);
}
}
tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php
View file @
068617eb
...
...
@@ -639,4 +639,15 @@ class DB2PlatformTest extends AbstractPlatformTestCase
{
return
false
;
}
/**
* {@inheritdoc}
*/
protected
function
getAlterStringToFixedStringSQL
()
{
return
array
(
'ALTER TABLE mytable ALTER COLUMN name SET DATA TYPE CHAR(2)'
,
'CALL SYSPROC.ADMIN_CMD (\'REORG TABLE mytable\')'
,
);
}
}
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
View file @
068617eb
...
...
@@ -658,4 +658,14 @@ EOD;
{
return
'INDEX "select" (foo)'
;
}
/**
* {@inheritdoc}
*/
protected
function
getAlterStringToFixedStringSQL
()
{
return
array
(
'ALTER TABLE mytable MODIFY (name CHAR(2) DEFAULT NULL)'
,
);
}
}
tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
View file @
068617eb
...
...
@@ -951,4 +951,14 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
{
return
false
;
}
/**
* {@inheritdoc}
*/
protected
function
getAlterStringToFixedStringSQL
()
{
return
array
(
'ALTER TABLE mytable ALTER name CHAR(2) NOT NULL'
,
);
}
}
tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php
View file @
068617eb
...
...
@@ -624,4 +624,18 @@ class SqlitePlatformTest extends AbstractPlatformTestCase
{
return
'INDEX "select" (foo)'
;
}
/**
* {@inheritdoc}
*/
protected
function
getAlterStringToFixedStringSQL
()
{
return
array
(
'CREATE TEMPORARY TABLE __temp__mytable AS SELECT name FROM mytable'
,
'DROP TABLE mytable'
,
'CREATE TABLE mytable (name CHAR(2) NOT NULL)'
,
'INSERT INTO mytable (name) SELECT name FROM __temp__mytable'
,
'DROP TABLE __temp__mytable'
,
);
}
}
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