/** * @dataProvider dataConstruct * @covers ::__construct * @covers ::getTable * @covers ::getCondition * @covers ::getType */ public function testConstruct($table, $condition, $type, $expectedTable, $expectedCondition, $expectedType) { $join = new SQL\Join($table, $condition, $type); $this->assertEquals($expectedTable, $join->getTable()); $this->assertEquals($expectedCondition, $join->getCondition()); $this->assertEquals($expectedType, $join->getType()); }
/** * Render a Join object * * @param SQL\Join $join * @return string */ public static function render(SQL\Join $join) { $condition = $join->getCondition(); $table = $join->getTable(); return Compiler::expression(array($join->getType(), 'JOIN', $table instanceof SQL\Aliased ? Aliased::render($table) : $table, is_array($condition) ? self::renderArrayCondition($condition) : $condition)); }