Added tests for inner join generation with eager loading
This commit is contained in:
parent
3994b80aa4
commit
0f938b8c1d
@ -115,6 +115,34 @@ class OneToOneEagerLoadingTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $waggon->train);
|
||||
$this->assertNotNull($waggon->train);
|
||||
}
|
||||
|
||||
public function testEagerLoadWithNullableColumnsGeneratesLeftJoin()
|
||||
{
|
||||
$train = new Train();
|
||||
$this->_em->persist($train);
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$train = $this->_em->find(get_class($train), $train->id);
|
||||
$this->assertEquals(
|
||||
$this->_sqlLoggerStack->queries[$this->_sqlLoggerStack->currentQuery]['sql'],
|
||||
"SELECT t0.id AS id1, t0.driver_id AS driver_id2, t3.id AS id4, t3.name AS name5 FROM Train t0 LEFT JOIN TrainDriver t3 ON t0.driver_id = t3.id WHERE t0.id = ?"
|
||||
);
|
||||
}
|
||||
|
||||
public function testEagerLoadWithNonNullableColumnsGeneratesInnerJoin()
|
||||
{
|
||||
$waggon = new Waggon();
|
||||
$this->_em->persist($waggon);
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$waggon = $this->_em->find(get_class($waggon), $waggon->id);
|
||||
$this->assertEquals(
|
||||
$this->_sqlLoggerStack->queries[$this->_sqlLoggerStack->currentQuery]['sql'],
|
||||
"SELECT t0.id AS id1, t0.train_id AS train_id2, t3.id AS id4, t3.driver_id AS driver_id5 FROM Waggon t0 INNER JOIN Train t3 ON t0.train_id = t3.id WHERE t0.id = ?"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user