Skip to content

Commit

Permalink
Merge pull request #787 from flip111/patch-1
Browse files Browse the repository at this point in the history
Update DDC719Test.php to be compatible with MsSQL
  • Loading branch information
guilhermeblanco committed Oct 7, 2013
2 parents 3f883d5 + 4282fa4 commit ded3d20
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/DDC719Test.php
Expand Up @@ -19,8 +19,10 @@ public function testIsEmptySqlGeneration()
{
$q = $this->_em->createQuery('SELECT g, c FROM Doctrine\Tests\ORM\Functional\Ticket\DDC719Group g LEFT JOIN g.children c WHERE g.parents IS EMPTY');

$referenceSQL = ($this->_em->getConnection()->getDatabasePlatform() instanceof SQLServerPlatform) ? 'SELECT g0_.name AS name0, g0_.description AS description1, g0_.id AS id2, g1_.name AS name3, g1_.description AS description4, g1_.id AS id5 FROM groups g0_ with (nolock) LEFT JOIN groups_groups g2_ ON g0_.id = g2_.parent_id LEFT JOIN groups g1_ ON g1_.id = g2_.child_id WHERE (SELECT COUNT(*) FROM groups_groups g3_ WHERE g3_.child_id = g0_.id) = 0' : 'SELECT g0_.name AS name0, g0_.description AS description1, g0_.id AS id2, g1_.name AS name3, g1_.description AS description4, g1_.id AS id5 FROM groups g0_ LEFT JOIN groups_groups g2_ ON g0_.id = g2_.parent_id LEFT JOIN groups g1_ ON g1_.id = g2_.child_id WHERE (SELECT COUNT(*) FROM groups_groups g3_ WHERE g3_.child_id = g0_.id) = 0';

$this->assertEquals(
strtolower('SELECT g0_.name AS name0, g0_.description AS description1, g0_.id AS id2, g1_.name AS name3, g1_.description AS description4, g1_.id AS id5 FROM groups g0_ LEFT JOIN groups_groups g2_ ON g0_.id = g2_.parent_id LEFT JOIN groups g1_ ON g1_.id = g2_.child_id WHERE (SELECT COUNT(*) FROM groups_groups g3_ WHERE g3_.child_id = g0_.id) = 0'),
strtolower($referenceSQL),
strtolower($q->getSQL())
);
}
Expand Down Expand Up @@ -109,4 +111,4 @@ public function setDescription($description) { $this->description = $description
public function getChildren() { return $this->children; }
public function getParents() { return $this->parents; }
public function getChannels() { return $this->channels; }
}
}

0 comments on commit ded3d20

Please sign in to comment.