Skip to content

Commit

Permalink
Some changes to the TestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Sep 20, 2010
1 parent 8a92bf0 commit 72f65c3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
28 changes: 13 additions & 15 deletions tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,21 @@ public function testJoinTablesWithMappedSuperclassForYamlDriver()
{
$em = $this->_getTestEntityManager();
$em->getConfiguration()->setMetadataDriverImpl(new \Doctrine\ORM\Mapping\Driver\YamlDriver(__DIR__ . '/yaml/'));
$qb = $em->createQueryBuilder();

$qb->select('f')
->from('Doctrine\Tests\ORM\Mapping\Page', 'f')
->join('f.parentDirectory', 'd')
->where(
$qb->expr()->andx(
$qb->expr()->eq('d.url', ':url'),
$qb->expr()->eq('f.extension', ':extension')
)
)
->setParameter('url', "test")
->setParameter('filename', "filename")
->setParameter('extension', "extension");

var_dump($em->getClassMetadata('Doctrine\Tests\ORM\Mapping\Page'));
var_dump($em->getClassMetadata('Doctrine\Tests\ORM\Mapping\Directory'));

$dql = "SELECT f FROM Doctrine\Tests\ORM\Mapping\Page f JOIN f.parentDirectory d " .
"WHERE (d.url = :url) AND (f.extension = :extension)";

$query = $em->createQuery($dql)
->setParameter('url', "test")
->setParameter('extension', "extension");

var_dump($query->getSql());

// Is there a way to generalize this more? (Instead of a2_., check if the table prefix in the ON clause is set within a FROM or JOIN clause..)
$this->assertTrue(strpos($qb->getQuery()->getSql(), 'a2_.') === false);
$this->assertTrue(strpos($query->getSql(), 'a2_.') === false);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Doctrine\Tests\ORM\Mapping\AbstractContentItem:
type: mappedSuperclass
table: abstract_item
id:
id:
type: integer
Expand Down

0 comments on commit 72f65c3

Please sign in to comment.