1
0
mirror of synced 2025-01-19 15:01:40 +03:00

Tests for new class based join column NamingStrategy

This commit is contained in:
Jack Sleight 2015-01-15 16:16:53 +00:00 committed by Marco Pivetta
parent be9d92bb26
commit 04d8f66b72

View File

@ -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));
} }
/** /**