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
18d5b5f9
Commit
18d5b5f9
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
0ac889b4
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
77 additions
and
20 deletions
+77
-20
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+31
-0
MySqlPlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
+10
-0
OraclePlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
+10
-0
PostgreSqlPlatformTest.php
.../Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
+2
-20
SQLServerPlatformTest.php
...s/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php
+10
-0
SqlitePlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php
+14
-0
No files found.
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
18d5b5f9
...
...
@@ -514,4 +514,35 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
implode
(
';'
,
$this
->
_platform
->
getAlterTableSQL
(
$tableDiff
))
);
}
/**
* @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/MySqlPlatformTest.php
View file @
18d5b5f9
...
...
@@ -378,4 +378,14 @@ class MySqlPlatformTest extends AbstractPlatformTestCase
"ALTER TABLE mytable ADD PRIMARY KEY (foo)"
,
),
$sql
);
}
/**
* {@inheritdoc}
*/
protected
function
getAlterStringToFixedStringSQL
()
{
return
array
(
'ALTER TABLE mytable CHANGE name name CHAR(2) NOT NULL'
,
);
}
}
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
View file @
18d5b5f9
...
...
@@ -330,4 +330,14 @@ class OraclePlatformTest extends AbstractPlatformTestCase
);
$this
->
assertEquals
(
$expectedSql
,
$this
->
_platform
->
getAlterTableSQL
(
$tableDiff
));
}
/**
* {@inheritdoc}
*/
protected
function
getAlterStringToFixedStringSQL
()
{
return
array
(
'ALTER TABLE mytable MODIFY (name CHAR(2) DEFAULT NULL)'
,
);
}
}
tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
View file @
18d5b5f9
...
...
@@ -487,29 +487,11 @@ class PostgreSqlPlatformTest extends AbstractPlatformTestCase
/**
* @group DBAL-1090
*/
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/SQLServerPlatformTest.php
View file @
18d5b5f9
...
...
@@ -343,4 +343,14 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase
array
(
LockMode
::
PESSIMISTIC_WRITE
,
' WITH (UPDLOCK, ROWLOCK)'
),
);
}
/**
* {@inheritdoc}
*/
protected
function
getAlterStringToFixedStringSQL
()
{
return
array
(
'ALTER TABLE mytable ALTER COLUMN name NCHAR(2) NOT NULL'
,
);
}
}
tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php
View file @
18d5b5f9
...
...
@@ -302,4 +302,18 @@ class SqlitePlatformTest extends AbstractPlatformTestCase
'CONSTRAINT FK_WITH_INTENDED_QUOTATION FOREIGN KEY ("create", foo, "bar") REFERENCES "foo-bar" ("create", bar, "foo-bar") NOT DEFERRABLE INITIALLY IMMEDIATE)'
,
);
}
/**
* {@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