From 72f65c366557bc75231d0caee8a6ba500e2e6114 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Mon, 20 Sep 2010 19:23:41 +0200 Subject: [PATCH] Some changes to the TestCase --- .../ORM/Mapping/YamlMappingDriverTest.php | 26 +++++++++---------- ...ts.ORM.Mapping.AbstractContentItem.dcm.yml | 1 - 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php index 1a60f7eb7..aa7ce716b 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php @@ -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); } } diff --git a/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.AbstractContentItem.dcm.yml b/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.AbstractContentItem.dcm.yml index 419eb0449..9137619ec 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.AbstractContentItem.dcm.yml +++ b/tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.ORM.Mapping.AbstractContentItem.dcm.yml @@ -1,6 +1,5 @@ Doctrine\Tests\ORM\Mapping\AbstractContentItem: type: mappedSuperclass - table: abstract_item id: id: type: integer