Skip to content

Instantly share code, notes, and snippets.

@hartym
Created May 19, 2009 15:19
Show Gist options
  • Save hartym/114169 to your computer and use it in GitHub Desktop.
Save hartym/114169 to your computer and use it in GitHub Desktop.
<?php
class Doctrine_Ticket_9999_TestCase extends Doctrine_UnitTestCase
{
public function prepareTables()
{
$this->tables[] = "Model1";
$this->tables[] = "Model2";
parent::prepareTables();
}
public function prepareData()
{
$this->myModel = new Model1();
$this->myModel->save();
}
public function testInit()
{
}
// This produces a failing test
public function testTest()
{
try
{
Doctrine::getTable('Model2')->createQuery('m2')->leftJoin('m2.Relation m1 ON m2.id = m1.m2_id')->execute();
$this->assertTrue(true);
}
catch(Doctrine_Exception $e)
{
$this->assertTrue(false);
}
try
{
Doctrine::getTable('Model2')->createQuery('m2')->leftJoin('m2.Relation m1 ON m2.id = m1.m2_id')->execute();
$this->assertTrue(true);
}
catch(Doctrine_Exception $e)
{
$this->assertTrue(false);
}
}
}
class Model1 extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('title', 'string');
$this->hasColumn('m2_id', 'integer');
}
}
class Model2 extends Doctrine_Record
{
public function setUp()
{
$this->hasMany('Model1 as Relation', array(
'local' => 'id',
'foreign' => 'm2_id'
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment