Commit 520489e8 authored by Steve Müller's avatar Steve Müller

Merge pull request #894 from LeoOnTheEarth/patch-2

Fixed correct value in "Doctrine\Tests\DBAL\Schema\Visitor\SchemaSqlCollectorTest"
parents 5d7d3c8e 6b50e251
......@@ -66,10 +66,7 @@ class CreateSchemaSqlCollector extends AbstractVisitor
public function acceptNamespace($namespaceName)
{
if ($this->platform->supportsSchemas()) {
$this->createNamespaceQueries = array_merge(
$this->createNamespaceQueries,
(array) $this->platform->getCreateSchemaSQL($namespaceName)
);
$this->createNamespaceQueries[] = $this->platform->getCreateSchemaSQL($namespaceName);
}
}
......@@ -87,12 +84,7 @@ class CreateSchemaSqlCollector extends AbstractVisitor
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
{
if ($this->platform->supportsForeignKeyConstraints()) {
$this->createFkConstraintQueries = array_merge(
$this->createFkConstraintQueries,
(array) $this->platform->getCreateForeignKeySQL(
$fkConstraint, $localTable
)
);
$this->createFkConstraintQueries[] = $this->platform->getCreateForeignKeySQL($fkConstraint, $localTable);
}
}
......@@ -101,10 +93,7 @@ class CreateSchemaSqlCollector extends AbstractVisitor
*/
public function acceptSequence(Sequence $sequence)
{
$this->createSequenceQueries = array_merge(
$this->createSequenceQueries,
(array) $this->platform->getCreateSequenceSQL($sequence)
);
$this->createSequenceQueries[] = $this->platform->getCreateSequenceSQL($sequence);
}
/**
......@@ -125,24 +114,11 @@ class CreateSchemaSqlCollector extends AbstractVisitor
*/
public function getQueries()
{
$sql = array();
foreach ($this->createNamespaceQueries as $schemaSql) {
$sql = array_merge($sql, (array) $schemaSql);
}
foreach ($this->createTableQueries as $schemaSql) {
$sql = array_merge($sql, (array) $schemaSql);
}
foreach ($this->createSequenceQueries as $schemaSql) {
$sql = array_merge($sql, (array) $schemaSql);
}
foreach ($this->createFkConstraintQueries as $schemaSql) {
$sql = array_merge($sql, (array) $schemaSql);
}
return $sql;
return array_merge(
$this->createNamespaceQueries,
$this->createTableQueries,
$this->createSequenceQueries,
$this->createFkConstraintQueries
);
}
}
......@@ -17,10 +17,10 @@ class SchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue(array("foo")));
$platformMock->expects($this->exactly(1))
->method('getCreateSequenceSql')
->will($this->returnValue(array("bar")));
->will($this->returnValue("bar"));
$platformMock->expects($this->exactly(1))
->method('getCreateForeignKeySql')
->will($this->returnValue(array("baz")));
->will($this->returnValue("baz"));
$schema = $this->createFixtureSchema();
......@@ -73,4 +73,4 @@ class SchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase
return $schema;
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment