Commit d4ffe56d authored by Steve Müller's avatar Steve Müller

fix table diff's new name if it is not set

parent d4005861
...@@ -155,10 +155,10 @@ class TableDiff ...@@ -155,10 +155,10 @@ class TableDiff
} }
/** /**
* @return \Doctrine\DBAL\Schema\Identifier * @return \Doctrine\DBAL\Schema\Identifier|false
*/ */
public function getNewName() public function getNewName()
{ {
return new Identifier($this->newName); return $this->newName ? new Identifier($this->newName) : $this->newName;
} }
} }
<?php
namespace Doctrine\Tests\DBAL\Schema;
use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\TableDiff;
class TableDiffTest extends \PHPUnit_Framework_TestCase
{
/**
* @group DBAL-1013
*/
public function testReturnsName()
{
$tableDiff = new TableDiff('foo');
$this->assertEquals(new Identifier('foo'), $tableDiff->getName());
}
/**
* @group DBAL-1013
*/
public function testReturnsNewName()
{
$tableDiff = new TableDiff('foo');
$this->assertFalse($tableDiff->getNewName());
$tableDiff->newName = 'bar';
$this->assertEquals(new Identifier('bar'), $tableDiff->getNewName());
}
}
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