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
600ff3fe
Commit
600ff3fe
authored
Apr 09, 2015
by
David Buchmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backport bugfix to avoid fatal error in array_merge during generating the table creation SQL.
2.5 included this fix in
1c9fe8df
parent
7c467c34
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
118 additions
and
1 deletion
+118
-1
CreateSchemaSqlCollector.php
...Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php
+1
-1
CreateSchemaSqlCollectorTest.php
...ests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php
+117
-0
No files found.
lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php
View file @
600ff3fe
...
...
@@ -64,7 +64,7 @@ class CreateSchemaSqlCollector extends AbstractVisitor
$this
->
createTableQueries
[
$namespace
]
=
array_merge
(
$this
->
createTableQueries
[
$namespace
],
$this
->
platform
->
getCreateTableSQL
(
$table
)
(
array
)
$this
->
platform
->
getCreateTableSQL
(
$table
)
);
}
...
...
tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php
0 → 100644
View file @
600ff3fe
<?php
namespace
Doctrine\Tests\DBAL\Schema\Visitor
;
use
\Doctrine\DBAL\Schema\Visitor\CreateSchemaSqlCollector
;
class
CreateSchemaSqlCollectorTest
extends
\PHPUnit_Framework_TestCase
{
/**
* @var \Doctrine\DBAL\Platforms\AbstractPlatform|\PHPUnit_Framework_MockObject_MockObject
*/
private
$platformMock
;
/**
* @var \Doctrine\DBAL\Schema\Visitor\CreateSchemaSqlCollector
*/
private
$visitor
;
/**
* {@inheritdoc}
*/
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
platformMock
=
$this
->
getMockBuilder
(
'Doctrine\DBAL\Platforms\AbstractPlatform'
)
->
setMethods
(
array
(
'getCreateForeignKeySQL'
,
'getCreateSchemaSQL'
,
'getCreateSequenceSQL'
,
'getCreateTableSQL'
,
'supportsForeignKeyConstraints'
,
'supportsSchemas'
)
)
->
getMockForAbstractClass
();
$this
->
visitor
=
new
CreateSchemaSqlCollector
(
$this
->
platformMock
);
foreach
(
array
(
'getCreateSchemaSQL'
,
'getCreateTableSQL'
,
'getCreateForeignKeySQL'
,
'getCreateSequenceSQL'
)
as
$method
)
{
$this
->
platformMock
->
expects
(
$this
->
any
())
->
method
(
$method
)
->
will
(
$this
->
returnValue
(
'foo'
));
}
}
public
function
testAcceptsTable
()
{
$table
=
$this
->
createTableMock
();
$this
->
visitor
->
acceptTable
(
$table
);
$this
->
assertSame
(
array
(
'foo'
),
$this
->
visitor
->
getQueries
());
}
public
function
testAcceptsSequences
()
{
$sequence
=
$this
->
createSequenceMock
();
$this
->
visitor
->
acceptSequence
(
$sequence
);
$this
->
assertSame
(
array
(
'foo'
),
$this
->
visitor
->
getQueries
());
}
public
function
testResetsQueries
()
{
foreach
(
array
(
'supportsSchemas'
,
'supportsForeignKeys'
)
as
$method
)
{
$this
->
platformMock
->
expects
(
$this
->
any
())
->
method
(
$method
)
->
will
(
$this
->
returnValue
(
true
));
}
$table
=
$this
->
createTableMock
();
$foreignKey
=
$this
->
createForeignKeyConstraintMock
();
$sequence
=
$this
->
createSequenceMock
();
$this
->
visitor
->
acceptTable
(
$table
);
$this
->
visitor
->
acceptForeignKey
(
$table
,
$foreignKey
);
$this
->
visitor
->
acceptSequence
(
$sequence
);
$this
->
assertNotEmpty
(
$this
->
visitor
->
getQueries
());
$this
->
visitor
->
resetQueries
();
$this
->
assertEmpty
(
$this
->
visitor
->
getQueries
());
}
/**
* @return \Doctrine\DBAL\Schema\ForeignKeyConstraint|\PHPUnit_Framework_MockObject_MockObject
*/
private
function
createForeignKeyConstraintMock
()
{
return
$this
->
getMockBuilder
(
'Doctrine\DBAL\Schema\ForeignKeyConstraint'
)
->
disableOriginalConstructor
()
->
getMock
();
}
/**
* @return \Doctrine\DBAL\Schema\Sequence|\PHPUnit_Framework_MockObject_MockObject
*/
private
function
createSequenceMock
()
{
return
$this
->
getMockBuilder
(
'Doctrine\DBAL\Schema\Sequence'
)
->
disableOriginalConstructor
()
->
getMock
();
}
/**
* @return \Doctrine\DBAL\Schema\Table|\PHPUnit_Framework_MockObject_MockObject
*/
private
function
createTableMock
()
{
return
$this
->
getMockBuilder
(
'Doctrine\DBAL\Schema\Table'
)
->
disableOriginalConstructor
()
->
getMock
();
}
}
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