public function testGettersAndSetters() { $clause = new ValuesClause(); $field = new StringExpression(); $field->setValue('abc'); $null = new ValueExpression(); $this->assertFalse($clause->hasExpressions()); $clause->addExpression($field); $this->assertTrue($clause->hasExpressions()); $this->assertSame([$field], $clause->getExpressions()); $clause->clearExpressions(); $clause->setExpressions([$field, $null]); $this->assertTrue($clause->hasExpressions()); $clause->clearExpressions(); $this->assertFalse($clause->hasExpressions()); $this->setExpectedException("InvalidArgumentException"); $clause->setExpressions([$field, $null, 'abc']); }
public function assembleValuesClause(ValuesClause $clause) { $assembled = '(' . implode(', ', $this->assembleSegments($clause->getExpressions())) . ')'; $assembler = $this->getAssembler(); if ($assembler->getData(self::MULTIPLE_VALUES)) { return $assembled; } $assembler->setData(self::MULTIPLE_VALUES, true); return $clause->getAction() . ' ' . $assembled; }