Tests for new class based join column NamingStrategy
This commit is contained in:
parent
be9d92bb26
commit
04d8f66b72
@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Mapping;
|
|||||||
|
|
||||||
use Doctrine\ORM\Mapping\UnderscoreNamingStrategy;
|
use Doctrine\ORM\Mapping\UnderscoreNamingStrategy;
|
||||||
use Doctrine\ORM\Mapping\DefaultNamingStrategy;
|
use Doctrine\ORM\Mapping\DefaultNamingStrategy;
|
||||||
|
use Doctrine\ORM\Mapping\JoinColumnClassNamingStrategy;
|
||||||
use Doctrine\ORM\Mapping\NamingStrategy;
|
use Doctrine\ORM\Mapping\NamingStrategy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,6 +20,14 @@ class NamingStrategyTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
return new DefaultNamingStrategy();
|
return new DefaultNamingStrategy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JoinColumnClassNamingStrategy
|
||||||
|
*/
|
||||||
|
static private function joinColumnClassNaming()
|
||||||
|
{
|
||||||
|
return new JoinColumnClassNamingStrategy();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return UnderscoreNamingStrategy
|
* @return UnderscoreNamingStrategy
|
||||||
*/
|
*/
|
||||||
@ -176,6 +185,14 @@ class NamingStrategyTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
array(self::underscoreNamingUpper(), 'SOME_COLUMN_ID',
|
array(self::underscoreNamingUpper(), 'SOME_COLUMN_ID',
|
||||||
'someColumn', null,
|
'someColumn', null,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// JoinColumnClassNamingStrategy
|
||||||
|
array(self::joinColumnClassNaming(), 'classname_someColumn_id',
|
||||||
|
'someColumn', 'Some\ClassName',
|
||||||
|
),
|
||||||
|
array(self::joinColumnClassNaming(), 'classname_some_column_id',
|
||||||
|
'some_column', 'ClassName',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,9 +203,9 @@ class NamingStrategyTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
* @param string $expected
|
* @param string $expected
|
||||||
* @param string $propertyName
|
* @param string $propertyName
|
||||||
*/
|
*/
|
||||||
public function testJoinColumnName(NamingStrategy $strategy, $expected, $propertyName)
|
public function testJoinColumnName(NamingStrategy $strategy, $expected, $propertyName, $className = null)
|
||||||
{
|
{
|
||||||
$this->assertEquals($expected, $strategy->joinColumnName($propertyName));
|
$this->assertEquals($expected, $strategy->joinColumnName($propertyName, $className));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user