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
d328488d
Commit
d328488d
authored
May 05, 2014
by
Guilherme Blanco
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #586 from JeroenDeDauw/DropSchemaSqlCollector
Change weird way of adding an entry to SplObjectStorage
parents
4a7ff71e
4ef88ef0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
2 deletions
+56
-2
DropSchemaSqlCollector.php
lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php
+1
-2
DropSchemaSqlCollectorTest.php
.../Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php
+55
-0
No files found.
lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php
View file @
d328488d
...
...
@@ -80,8 +80,7 @@ class DropSchemaSqlCollector extends AbstractVisitor
throw
SchemaException
::
namedForeignKeyRequired
(
$localTable
,
$fkConstraint
);
}
$this
->
constraints
->
attach
(
$fkConstraint
);
$this
->
constraints
[
$fkConstraint
]
=
$localTable
;
$this
->
constraints
->
attach
(
$fkConstraint
,
$localTable
);
}
/**
...
...
tests/Doctrine/Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php
0 → 100644
View file @
d328488d
<?php
namespace
Doctrine\Tests\DBAL\Schema\Visitor
;
use
\Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector
;
class
DropSchemaSqlCollectorTest
extends
\PHPUnit_Framework_TestCase
{
public
function
testGetQueriesUsesAcceptedForeignKeys
()
{
$tableOne
=
$this
->
getMockWithoutArguments
(
'Doctrine\DBAL\Schema\Table'
);
$tableTwo
=
$this
->
getMockWithoutArguments
(
'Doctrine\DBAL\Schema\Table'
);
$keyConstraintOne
=
$this
->
getStubKeyConstraint
(
'first'
);
$keyConstraintTwo
=
$this
->
getStubKeyConstraint
(
'second'
);
$platform
=
$this
->
getMockBuilder
(
'Doctrine\DBAL\Platforms\AbstractPlatform'
)
->
setMethods
(
array
(
'getDropForeignKeySQL'
))
->
getMockForAbstractClass
();
$collector
=
new
DropSchemaSqlCollector
(
$platform
);
$platform
->
expects
(
$this
->
exactly
(
2
))
->
method
(
'getDropForeignKeySQL'
);
$platform
->
expects
(
$this
->
at
(
0
))
->
method
(
'getDropForeignKeySQL'
)
->
with
(
$keyConstraintOne
,
$tableOne
);
$platform
->
expects
(
$this
->
at
(
1
))
->
method
(
'getDropForeignKeySQL'
)
->
with
(
$keyConstraintTwo
,
$tableTwo
);
$collector
->
acceptForeignKey
(
$tableOne
,
$keyConstraintOne
);
$collector
->
acceptForeignKey
(
$tableTwo
,
$keyConstraintTwo
);
$collector
->
getQueries
();
}
private
function
getMockWithoutArguments
(
$className
)
{
return
$this
->
getMockBuilder
(
$className
)
->
disableOriginalConstructor
()
->
getMock
();
}
private
function
getStubKeyConstraint
(
$name
)
{
$constraint
=
$this
->
getMockWithoutArguments
(
'Doctrine\DBAL\Schema\ForeignKeyConstraint'
);
$constraint
->
expects
(
$this
->
any
())
->
method
(
'getName'
)
->
will
(
$this
->
returnValue
(
$name
));
return
$constraint
;
}
}
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