Skip to content

Commit

Permalink
Added unit test for mySQl addColumn FIRST logic
Browse files Browse the repository at this point in the history
  • Loading branch information
IceShack committed Mar 29, 2015
1 parent e6e18a2 commit 2e9f1a2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
*
*/
class MysqlPlatformMigrationTest extends PlatformMigrationTestProvider
class MysqlPlatformMigrationTest extends MysqlPlatformMigrationTestProvider
{
protected $platform;

Expand Down Expand Up @@ -299,6 +299,17 @@ public function testGetAddColumnDDL($column)
$this->assertEquals($expected, $this->getPlatform()->getAddColumnDDL($column));
}

/**
* @dataProvider providerForTestGetAddColumnFirstDDL
*/
public function testGetAddColumnFirstDDL($column)
{
$expected = "
ALTER TABLE `foo` ADD `bar` INTEGER FIRST;
";
$this->assertEquals($expected, $this->getPlatform()->getAddColumnDDL($column));
}

/**
* @dataProvider providerForTestGetAddColumnsDDL
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

/**
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/

namespace Propel\Tests\Generator\Platform;

/**
* provider for mysql platform migration unit tests
*/
class MysqlPlatformMigrationTestProvider extends PlatformMigrationTestProvider {


public function providerForTestGetAddColumnFirstDDL()
{
$schema = <<<EOF
<database name="test" identifierQuoting="true">
<table name="foo">
<column name="bar" type="INTEGER" />
<column name="id" primaryKey="true" type="INTEGER" autoIncrement="true" />
</table>
</database>
EOF;
$column = $this->getDatabaseFromSchema($schema)->getTable('foo')->getColumn('bar');

return array(array($column));
}
}

0 comments on commit 2e9f1a2

Please sign in to comment.