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
66f28111
Unverified
Commit
66f28111
authored
Jun 17, 2019
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bpo/2.9/#3456' into 2.9
parents
2c68488f
212ac4dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
1 deletion
+37
-1
Comparator.php
lib/Doctrine/DBAL/Schema/Comparator.php
+6
-1
ComparatorTest.php
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
+31
-0
No files found.
lib/Doctrine/DBAL/Schema/Comparator.php
View file @
66f28111
...
@@ -11,6 +11,7 @@ use function array_merge;
...
@@ -11,6 +11,7 @@ use function array_merge;
use
function
array_shift
;
use
function
array_shift
;
use
function
array_unique
;
use
function
array_unique
;
use
function
count
;
use
function
count
;
use
function
get_class
;
use
function
strtolower
;
use
function
strtolower
;
/**
/**
...
@@ -417,7 +418,11 @@ class Comparator
...
@@ -417,7 +418,11 @@ class Comparator
$changedProperties
=
[];
$changedProperties
=
[];
foreach
([
'type'
,
'notnull'
,
'unsigned'
,
'autoincrement'
]
as
$property
)
{
if
(
get_class
(
$properties1
[
'type'
])
!==
get_class
(
$properties2
[
'type'
]))
{
$changedProperties
[]
=
'type'
;
}
foreach
([
'notnull'
,
'unsigned'
,
'autoincrement'
]
as
$property
)
{
if
(
$properties1
[
$property
]
===
$properties2
[
$property
])
{
if
(
$properties1
[
$property
]
===
$properties2
[
$property
])
{
continue
;
continue
;
}
}
...
...
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
View file @
66f28111
...
@@ -16,6 +16,7 @@ use Doctrine\DBAL\Schema\TableDiff;
...
@@ -16,6 +16,7 @@ use Doctrine\DBAL\Schema\TableDiff;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
;
use
PHPUnit\Framework\TestCase
;
use
PHPUnit\Framework\TestCase
;
use
function
array_keys
;
use
function
array_keys
;
use
function
get_class
;
class
ComparatorTest
extends
TestCase
class
ComparatorTest
extends
TestCase
{
{
...
@@ -193,6 +194,36 @@ class ComparatorTest extends TestCase
...
@@ -193,6 +194,36 @@ class ComparatorTest extends TestCase
self
::
assertEquals
([],
$c
->
diffColumn
(
$column1
,
$column1
));
self
::
assertEquals
([],
$c
->
diffColumn
(
$column1
,
$column1
));
}
}
public
function
testCompareColumnsMultipleTypeInstances
()
:
void
{
$integerType1
=
Type
::
getType
(
'integer'
);
Type
::
overrideType
(
'integer'
,
get_class
(
$integerType1
));
$integerType2
=
Type
::
getType
(
'integer'
);
$column1
=
new
Column
(
'integerfield1'
,
$integerType1
);
$column2
=
new
Column
(
'integerfield1'
,
$integerType2
);
$c
=
new
Comparator
();
self
::
assertEquals
([],
$c
->
diffColumn
(
$column1
,
$column2
));
}
public
function
testCompareColumnsOverriddenType
()
:
void
{
$oldStringInstance
=
Type
::
getType
(
'string'
);
$integerType
=
Type
::
getType
(
'integer'
);
Type
::
overrideType
(
'string'
,
get_class
(
$integerType
));
$overriddenStringType
=
Type
::
getType
(
'string'
);
Type
::
overrideType
(
'string'
,
get_class
(
$oldStringInstance
));
$column1
=
new
Column
(
'integerfield1'
,
$integerType
);
$column2
=
new
Column
(
'integerfield1'
,
$overriddenStringType
);
$c
=
new
Comparator
();
self
::
assertEquals
([],
$c
->
diffColumn
(
$column1
,
$column2
));
}
public
function
testCompareChangedColumnsChangeCustomSchemaOption
()
public
function
testCompareChangedColumnsChangeCustomSchemaOption
()
{
{
$column1
=
new
Column
(
'charfield1'
,
Type
::
getType
(
'string'
));
$column1
=
new
Column
(
'charfield1'
,
Type
::
getType
(
'string'
));
...
...
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