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 = $this->_getTestEntityManager();
$em->getConfiguration()->setMetadataDriverImpl(new \Doctrine\ORM\Mapping\Driver\YamlDriver(__DIR__ . '/yaml/')); $em->getConfiguration()->setMetadataDriverImpl(new \Doctrine\ORM\Mapping\Driver\YamlDriver(__DIR__ . '/yaml/'));
$qb = $em->createQueryBuilder();
$qb->select('f') var_dump($em->getClassMetadata('Doctrine\Tests\ORM\Mapping\Page'));
->from('Doctrine\Tests\ORM\Mapping\Page', 'f') var_dump($em->getClassMetadata('Doctrine\Tests\ORM\Mapping\Directory'));
->join('f.parentDirectory', 'd')
->where( $dql = "SELECT f FROM Doctrine\Tests\ORM\Mapping\Page f JOIN f.parentDirectory d " .
$qb->expr()->andx( "WHERE (d.url = :url) AND (f.extension = :extension)";
$qb->expr()->eq('d.url', ':url'),
$qb->expr()->eq('f.extension', ':extension') $query = $em->createQuery($dql)
) ->setParameter('url', "test")
) ->setParameter('extension', "extension");
->setParameter('url', "test")
->setParameter('filename', "filename") var_dump($query->getSql());
->setParameter('extension', "extension");
// 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..) // 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: Doctrine\Tests\ORM\Mapping\AbstractContentItem:
type: mappedSuperclass type: mappedSuperclass
table: abstract_item
id: id:
id: id:
type: integer type: integer