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
9b19ff48
Commit
9b19ff48
authored
Feb 06, 2014
by
Jose M. Alonso M
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added new test WriteTest::testEmptyIdentityInsert().
parent
a0777077
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
WriteTest.php
tests/Doctrine/Tests/DBAL/Functional/WriteTest.php
+41
-0
No files found.
tests/Doctrine/Tests/DBAL/Functional/WriteTest.php
View file @
9b19ff48
...
...
@@ -246,4 +246,45 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
assertFalse
(
$data
);
}
public
function
testEmptyIdentityInsert
()
{
$platform
=
$this
->
_conn
->
getDatabasePlatform
();
if
(
!
(
$platform
->
supportsIdentityColumns
()
||
$platform
->
usesSequenceEmulatedIdentityColumns
())
)
{
$this
->
markTestSkipped
(
'Test only works on platforms with identity columns or sequence emulated identity columns.'
);
}
$table
=
new
\Doctrine\DBAL\Schema\Table
(
'test_empty_identity'
);
$table
->
addColumn
(
'id'
,
'integer'
,
array
(
'autoincrement'
=>
true
));
$table
->
setPrimaryKey
(
array
(
'id'
));
try
{
$this
->
_conn
->
getSchemaManager
()
->
dropTable
(
$table
);
}
catch
(
\Exception
$e
)
{
}
foreach
(
$platform
->
getCreateTableSQL
(
$table
)
as
$sql
)
{
$this
->
_conn
->
exec
(
$sql
);
}
$seqName
=
$platform
->
usesSequenceEmulatedIdentityColumns
()
?
$platform
->
getIdentitySequenceName
(
'test_empty_identity'
,
'id'
)
:
null
;
$sql
=
$platform
->
getEmptyIdentityInsertSQL
(
'test_empty_identity'
,
'id'
);
$this
->
_conn
->
exec
(
$sql
);
$firstId
=
$this
->
_conn
->
lastInsertId
(
$seqName
);
$this
->
_conn
->
exec
(
$sql
);
$secondId
=
$this
->
_conn
->
lastInsertId
(
$seqName
);
$this
->
assertTrue
(
$secondId
>
$firstId
);
}
}
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