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
bd5e190a
Unverified
Commit
bd5e190a
authored
May 01, 2018
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bpo/2.7/#3086' into 2.7
parents
a6b7bb81
eca1c525
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
16 deletions
+53
-16
OracleSchemaManager.php
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
+2
-2
PostgreSqlSchemaManager.php
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
+1
-1
SQLServerSchemaManager.php
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
+1
-1
Sequence.php
lib/Doctrine/DBAL/Schema/Sequence.php
+2
-2
SchemaManagerFunctionalTestCase.php
...BAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
+47
-10
No files found.
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
View file @
bd5e190a
...
...
@@ -303,8 +303,8 @@ class OracleSchemaManager extends AbstractSchemaManager
return
new
Sequence
(
$this
->
getQuotedIdentifierName
(
$sequence
[
'sequence_name'
]),
$sequence
[
'increment_by'
],
$sequence
[
'min_value'
]
(
int
)
$sequence
[
'increment_by'
],
(
int
)
$sequence
[
'min_value'
]
);
}
...
...
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
View file @
bd5e190a
...
...
@@ -311,7 +311,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$sequence
+=
$data
;
}
return
new
Sequence
(
$sequenceName
,
$sequence
[
'increment_by'
],
$sequence
[
'min_value'
]);
return
new
Sequence
(
$sequenceName
,
(
int
)
$sequence
[
'increment_by'
],
(
int
)
$sequence
[
'min_value'
]);
}
/**
...
...
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
View file @
bd5e190a
...
...
@@ -76,7 +76,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
*/
protected
function
_getPortableSequenceDefinition
(
$sequence
)
{
return
new
Sequence
(
$sequence
[
'name'
],
$sequence
[
'increment'
],
$sequence
[
'start_value'
]);
return
new
Sequence
(
$sequence
[
'name'
],
(
int
)
$sequence
[
'increment'
],
(
int
)
$sequence
[
'start_value'
]);
}
/**
...
...
lib/Doctrine/DBAL/Schema/Sequence.php
View file @
bd5e190a
tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
View file @
bd5e190a
...
...
@@ -18,6 +18,7 @@ use function array_filter;
use
function
array_keys
;
use
function
array_map
;
use
function
array_search
;
use
function
array_values
;
use
function
count
;
use
function
current
;
use
function
end
;
...
...
@@ -25,6 +26,7 @@ use function explode;
use
function
get_class
;
use
function
in_array
;
use
function
str_replace
;
use
function
strcasecmp
;
use
function
strlen
;
use
function
strtolower
;
use
function
substr
;
...
...
@@ -123,7 +125,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
$name
=
'dropcreate_sequences_test_seq'
;
$this
->
_sm
->
dropAndCreateSequence
(
new
\Doctrine\DBAL\Schema\
Sequence
(
$name
,
20
,
10
));
$this
->
_sm
->
dropAndCreateSequence
(
new
Sequence
(
$name
,
20
,
10
));
self
::
assertTrue
(
$this
->
hasElementWithName
(
$this
->
_sm
->
listSequences
(),
$name
));
}
...
...
@@ -142,11 +144,11 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
public
function
testListSequences
()
{
if
(
!
$this
->
_conn
->
getDatabasePlatform
()
->
supportsSequences
())
{
$this
->
markTestSkipped
(
$this
->
_conn
->
getDriver
()
->
getName
()
.
' does not support sequences.'
);
if
(
!
$this
->
_conn
->
getDatabasePlatform
()
->
supportsSequences
())
{
$this
->
markTestSkipped
(
$this
->
_conn
->
getDriver
()
->
getName
()
.
' does not support sequences.'
);
}
$sequence
=
new
\Doctrine\DBAL\Schema\
Sequence
(
'list_sequences_test_seq'
,
20
,
10
);
$sequence
=
new
Sequence
(
'list_sequences_test_seq'
,
20
,
10
);
$this
->
_sm
->
createSequence
(
$sequence
);
$sequences
=
$this
->
_sm
->
listSequences
();
...
...
@@ -154,16 +156,18 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
self
::
assertInternalType
(
'array'
,
$sequences
,
'listSequences() should return an array.'
);
$foundSequence
=
null
;
foreach
(
$sequences
as
$sequence
)
{
self
::
assertInstanceOf
(
'Doctrine\DBAL\Schema\Sequence'
,
$sequence
,
'Array elements of listSequences() should be Sequence instances.'
);
if
(
strtolower
(
$sequence
->
getName
())
==
'list_sequences_test_seq'
)
{
$foundSequence
=
$sequenc
e
;
foreach
(
$sequences
as
$sequence
)
{
self
::
assertInstanceOf
(
Sequence
::
class
,
$sequence
,
'Array elements of listSequences() should be Sequence instances.'
);
if
(
strtolower
(
$sequence
->
getName
())
!
==
'list_sequences_test_seq'
)
{
continu
e
;
}
$foundSequence
=
$sequence
;
}
self
::
assertNotNull
(
$foundSequence
,
"Sequence with name 'list_sequences_test_seq' was not found."
);
self
::
assert
Equals
(
20
,
$foundSequence
->
getAllocationSize
(),
"Allocation Size is expected to be 20."
);
self
::
assert
Equals
(
10
,
$foundSequence
->
getInitialValue
(),
"Initial Value is expected to be 10."
);
self
::
assert
Same
(
20
,
$foundSequence
->
getAllocationSize
(),
'Allocation Size is expected to be 20.'
);
self
::
assert
Same
(
10
,
$foundSequence
->
getInitialValue
(),
'Initial Value is expected to be 10.'
);
}
public
function
testListDatabases
()
...
...
@@ -1452,4 +1456,37 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
self
::
assertEquals
(
$sequence2AllocationSize
,
$actualSequence2
->
getAllocationSize
());
self
::
assertEquals
(
$sequence2InitialValue
,
$actualSequence2
->
getInitialValue
());
}
/**
* @group #3086
*/
public
function
testComparisonWithAutoDetectedSequenceDefinition
()
:
void
{
if
(
!
$this
->
_sm
->
getDatabasePlatform
()
->
supportsSequences
())
{
self
::
markTestSkipped
(
'This test is only supported on platforms that support sequences.'
);
}
$sequenceName
=
'sequence_auto_detect_test'
;
$sequenceAllocationSize
=
5
;
$sequenceInitialValue
=
10
;
$sequence
=
new
Sequence
(
$sequenceName
,
$sequenceAllocationSize
,
$sequenceInitialValue
);
$this
->
_sm
->
dropAndCreateSequence
(
$sequence
);
$createdSequence
=
array_values
(
array_filter
(
$this
->
_sm
->
listSequences
(),
function
(
Sequence
$sequence
)
use
(
$sequenceName
)
:
bool
{
return
strcasecmp
(
$sequence
->
getName
(),
$sequenceName
)
===
0
;
}
)
)[
0
]
??
null
;
self
::
assertNotNull
(
$createdSequence
);
$comparator
=
new
Comparator
();
$tableDiff
=
$comparator
->
diffSequence
(
$createdSequence
,
$sequence
);
self
::
assertFalse
(
$tableDiff
);
}
}
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