public function testParseSourceJoinSubqueryAutoAlias() { $sq1 = new Result($this->connection, 'tab2'); $sq2 = new Result($this->connection, 'tab3'); $result = new Result($this->connection, 'tab1'); $this->assertEquals("`tab1`\nLEFT JOIN (\n\tSELECT *\n\tFROM `tab2`\n) `_join_1` ON `foo`" . "\nLEFT JOIN (\n\tSELECT *\n\tFROM `tab3`\n) `_join_2` ON `bar`", $this->parser($result->leftJoin($sq1, ':foo')->leftJoin($sq2, ':bar'))->parseSource()); }
public function testHasCircularReferencesDeeper() { $this->setExpectedException('RuntimeException', 'Circular reference found'); $subquery = new Result($this->connection, $this->result); $this->result->leftJoin($subquery, 'foo')->dump(true); }