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
4084f97a
Commit
4084f97a
authored
May 05, 2014
by
jeroendedauw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add testGivenForeignKeyWithZeroLength_acceptForeignKeyThrowsException
parent
d328488d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
8 deletions
+34
-8
DropSchemaSqlCollector.php
lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php
+2
-2
DropSchemaSqlCollectorTest.php
.../Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php
+32
-6
No files found.
lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php
View file @
4084f97a
...
@@ -50,12 +50,12 @@ class DropSchemaSqlCollector extends AbstractVisitor
...
@@ -50,12 +50,12 @@ class DropSchemaSqlCollector extends AbstractVisitor
private
$tables
;
private
$tables
;
/**
/**
* @var
\Doctrine\DBAL\Platforms\
AbstractPlatform
* @var AbstractPlatform
*/
*/
private
$platform
;
private
$platform
;
/**
/**
* @param
\Doctrine\DBAL\Platforms\
AbstractPlatform $platform
* @param AbstractPlatform $platform
*/
*/
public
function
__construct
(
AbstractPlatform
$platform
)
public
function
__construct
(
AbstractPlatform
$platform
)
{
{
...
...
tests/Doctrine/Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php
View file @
4084f97a
...
@@ -2,14 +2,17 @@
...
@@ -2,14 +2,17 @@
namespace
Doctrine\Tests\DBAL\Schema\Visitor
;
namespace
Doctrine\Tests\DBAL\Schema\Visitor
;
use
\
Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector
;
use
Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector
;
/**
* @covers Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector
*/
class
DropSchemaSqlCollectorTest
extends
\PHPUnit_Framework_TestCase
class
DropSchemaSqlCollectorTest
extends
\PHPUnit_Framework_TestCase
{
{
public
function
testGetQueriesUsesAcceptedForeignKeys
()
public
function
testGetQueriesUsesAcceptedForeignKeys
()
{
{
$tableOne
=
$this
->
get
MockWithoutArguments
(
'Doctrine\DBAL\Schema\Table'
);
$tableOne
=
$this
->
get
TableMock
(
);
$tableTwo
=
$this
->
get
MockWithoutArguments
(
'Doctrine\DBAL\Schema\Table'
);
$tableTwo
=
$this
->
get
TableMock
(
);
$keyConstraintOne
=
$this
->
getStubKeyConstraint
(
'first'
);
$keyConstraintOne
=
$this
->
getStubKeyConstraint
(
'first'
);
$keyConstraintTwo
=
$this
->
getStubKeyConstraint
(
'second'
);
$keyConstraintTwo
=
$this
->
getStubKeyConstraint
(
'second'
);
...
@@ -37,6 +40,11 @@ class DropSchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase
...
@@ -37,6 +40,11 @@ class DropSchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase
$collector
->
getQueries
();
$collector
->
getQueries
();
}
}
private
function
getTableMock
()
{
return
$this
->
getMockWithoutArguments
(
'Doctrine\DBAL\Schema\Table'
);
}
private
function
getMockWithoutArguments
(
$className
)
private
function
getMockWithoutArguments
(
$className
)
{
{
return
$this
->
getMockBuilder
(
$className
)
->
disableOriginalConstructor
()
->
getMock
();
return
$this
->
getMockBuilder
(
$className
)
->
disableOriginalConstructor
()
->
getMock
();
...
@@ -50,6 +58,24 @@ class DropSchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase
...
@@ -50,6 +58,24 @@ class DropSchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase
->
method
(
'getName'
)
->
method
(
'getName'
)
->
will
(
$this
->
returnValue
(
$name
));
->
will
(
$this
->
returnValue
(
$name
));
$constraint
->
expects
(
$this
->
any
())
->
method
(
'getForeignColumns'
)
->
will
(
$this
->
returnValue
(
array
()));
$constraint
->
expects
(
$this
->
any
())
->
method
(
'getColumns'
)
->
will
(
$this
->
returnValue
(
array
()));
return
$constraint
;
return
$constraint
;
}
}
public
function
testGivenForeignKeyWithZeroLength_acceptForeignKeyThrowsException
()
{
$collector
=
new
DropSchemaSqlCollector
(
$this
->
getMockForAbstractClass
(
'Doctrine\DBAL\Platforms\AbstractPlatform'
)
);
$this
->
setExpectedException
(
'Doctrine\DBAL\Schema\SchemaException'
);
$collector
->
acceptForeignKey
(
$this
->
getTableMock
(),
$this
->
getStubKeyConstraint
(
''
));
}
}
}
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