1
0
mirror of synced 2024-12-13 22:56:04 +03:00

Some changes to the TestCase

This commit is contained in:
Benjamin Eberlei 2010-09-20 19:23:41 +02:00
parent 8a92bf075b
commit 72f65c3665
2 changed files with 12 additions and 15 deletions

View File

@ -23,23 +23,21 @@ class YamlMappingDriverTest extends AbstractMappingDriverTest
{
$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);
}
}

View File

@ -1,6 +1,5 @@
Doctrine\Tests\ORM\Mapping\AbstractContentItem:
type: mappedSuperclass
table: abstract_item
id:
id:
type: integer