article_id:  ~
        author_id:   ~
      author:
        id:          ~
        name:        varchar(255)

Beware that the tables for these models will be emptied by the tests, so use a test database connection.
*/

include dirname(__FILE__).'/../../bootstrap.php';

// cleanup database
ArticlePeer::doDeleteAll();

$t = new lime_test(5, new lime_output_color());

$t->diag('getColName()');

class myFinder extends sfPropelFinder
{
  public function getColName($phpName, $peerClass = null, $withPeerClass = false, $autoAddJoin = false)
  {
    return parent::getColName($phpName, $peerClass, $withPeerClass, $autoAddJoin);
  }
}
$finder = new myFinder('Article');
$t->is($finder->getColName('Title'), 'article.TITLE', 'getColName() recognizes [column phpName]');
$t->is($finder->getColName('Article_Title'), 'article.TITLE', 'getColName() recognizes [table phpName]_[column phpName]');
$t->is($finder->getColName('Article.Title'), 'article.TITLE', 'getColName() recognizes [table phpName].[column phpName]');
$t->is($finder->getColName('Article.CategoryId'), 'article.CATEGORY_ID', 'getColName() expects column names in CamelCase');
$t->is($finder->getColName('Article.categoryId'), 'article.CATEGORY_ID', 'getColName() is tolerant over the first letter capitalization');
        author_id:   ~
      author:
        id:          ~
        name:        varchar(255)

Beware that the tables for these models will be emptied by the tests, so use a test database connection.
*/

include dirname(__FILE__).'/../../bootstrap.php';

$t = new lime_test(7, new lime_output_color());

$t->diag('getColName()');

class myFinder extends sfDoctrineFinder
{
  public function getColName($phpName, $class = null, $detail = false, $autoAddJoin = false)
  {
    return parent::getColName($phpName, $class, $detail, $autoAddJoin);
  }
}
$finder = new myFinder('DArticle');
$t->is($finder->getColName('Title'), 'DArticle.title', 'getColName() recognizes [column phpName]');
$t->is($finder->getColName('DArticle_Title'), 'DArticle.title', 'getColName() recognizes [table phpName]_[column phpName]');
$t->is($finder->getColName('DArticle.Title'), 'DArticle.title', 'getColName() recognizes [table phpName].[column phpName]');
$t->is($finder->getColName('DArticle.CategoryId'), 'DArticle.category_id', 'getColName() expects column names in CamelCase');
$t->is($finder->getColName('DArticle.categoryId'), 'DArticle.category_id', 'getColName() is tolerant over the first letter capitalization');
$t->is($finder->getColName('d.Title'), 'd.title', 'getColName() recognizes [table alias].[column phpName]');

$finder = new myFinder('DArticle b');
$t->is($finder->getColName('b.Title'), 'b.title', 'getColName() recognizes [table alias].[column phpName]');