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
e5d1edc2
Unverified
Commit
e5d1edc2
authored
Jan 13, 2020
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bpo/2.10/#3790' into 2.10
parents
d49d68f6
a5256109
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
ForeignKeyConstraint.php
lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php
+1
-1
ForeignKeyConstraintTest.php
...s/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php
+27
-0
No files found.
lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php
View file @
e5d1edc2
...
...
@@ -233,7 +233,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
$position
=
strrpos
(
$name
,
'.'
);
if
(
$position
!==
false
)
{
$name
=
substr
(
$name
,
$position
);
$name
=
substr
(
$name
,
$position
+
1
);
}
return
strtolower
(
$name
);
...
...
tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php
View file @
e5d1edc2
...
...
@@ -4,6 +4,7 @@ namespace Doctrine\Tests\DBAL\Schema;
use
Doctrine\DBAL\Schema\ForeignKeyConstraint
;
use
Doctrine\DBAL\Schema\Index
;
use
Doctrine\DBAL\Schema\Table
;
use
PHPUnit\Framework\TestCase
;
class
ForeignKeyConstraintTest
extends
TestCase
...
...
@@ -56,4 +57,30 @@ class ForeignKeyConstraintTest extends TestCase
[[
'FOO'
],
true
],
];
}
/**
* @param string|Table $foreignTableName
*
* @group DBAL-1062
* @dataProvider getUnqualifiedForeignTableNameData
*/
public
function
testGetUnqualifiedForeignTableName
(
$foreignTableName
,
string
$expectedUnqualifiedTableName
)
:
void
{
$foreignKey
=
new
ForeignKeyConstraint
([
'foo'
,
'bar'
],
$foreignTableName
,
[
'fk_foo'
,
'fk_bar'
]);
self
::
assertSame
(
$expectedUnqualifiedTableName
,
$foreignKey
->
getUnqualifiedForeignTableName
());
}
/**
* @return mixed[][]
*/
public
static
function
getUnqualifiedForeignTableNameData
()
:
iterable
{
return
[
[
'schema.foreign_table'
,
'foreign_table'
],
[
'foreign_table'
,
'foreign_table'
],
[
new
Table
(
'schema.foreign_table'
),
'foreign_table'
],
[
new
Table
(
'foreign_table'
),
'foreign_table'
],
];
}
}
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