public function testGettersAndSetters() { $clause = new SelectClause(); $field = new FieldSelectExpression(); $now = new NowSelectExpression(); $this->assertFalse($clause->hasExpressions()); $clause->addExpression($field); $this->assertTrue($clause->hasExpressions()); $this->assertSame([$field], $clause->getExpressions()); $clause->clearExpressions(); $clause->setExpressions([$field, $now]); $this->assertTrue($clause->hasExpressions()); $clause->clearExpressions(); $this->assertFalse($clause->hasExpressions()); $this->setExpectedException("InvalidArgumentException"); $clause->setExpressions([$field, $now, 'abc']); }
public function assembleSelectClause(SelectClause $clause) { $return = $clause->getAction() . ($clause->isDistinct() ? ' DISTINCT' : ''); if (!$clause->hasExpressions()) { return $return . ' *'; } return $return . ' ' . implode(', ', $this->assembleSegments($clause->getExpressions())); }