@@ 676-689 (lines=14) @@ | ||
673 | /** |
|
674 | * @group DBAL-442 |
|
675 | */ |
|
676 | public function testSelectWithMultipleFromAndJoins() |
|
677 | { |
|
678 | $qb = new QueryBuilder($this->conn); |
|
679 | ||
680 | $qb->select('DISTINCT u.id') |
|
681 | ->from('users', 'u') |
|
682 | ->from('articles', 'a') |
|
683 | ->innerJoin('u', 'permissions', 'p', 'p.user_id = u.id') |
|
684 | ->innerJoin('a', 'comments', 'c', 'c.article_id = a.id') |
|
685 | ->where('u.id = a.user_id') |
|
686 | ->andWhere('p.read = 1'); |
|
687 | ||
688 | self::assertEquals('SELECT DISTINCT u.id FROM users u INNER JOIN permissions p ON p.user_id = u.id, articles a INNER JOIN comments c ON c.article_id = a.id WHERE (u.id = a.user_id) AND (p.read = 1)', $qb->getSQL()); |
|
689 | } |
|
690 | ||
691 | /** |
|
692 | * @group DBAL-774 |
|
@@ 786-799 (lines=14) @@ | ||
783 | self::assertEquals("SELECT id, name FROM users WHERE awesome=9001", (string) $qb); |
|
784 | } |
|
785 | ||
786 | public function testComplexSelectWithoutTableAliases() |
|
787 | { |
|
788 | $qb = new QueryBuilder($this->conn); |
|
789 | ||
790 | $qb->select('DISTINCT users.id') |
|
791 | ->from('users') |
|
792 | ->from('articles') |
|
793 | ->innerJoin('users', 'permissions', 'p', 'p.user_id = users.id') |
|
794 | ->innerJoin('articles', 'comments', 'c', 'c.article_id = articles.id') |
|
795 | ->where('users.id = articles.user_id') |
|
796 | ->andWhere('p.read = 1'); |
|
797 | ||
798 | self::assertEquals('SELECT DISTINCT users.id FROM users INNER JOIN permissions p ON p.user_id = users.id, articles INNER JOIN comments c ON c.article_id = articles.id WHERE (users.id = articles.user_id) AND (p.read = 1)', $qb->getSQL()); |
|
799 | } |
|
800 | ||
801 | public function testComplexSelectWithSomeTableAliases() |
|
802 | { |