/** * Tests the \Joomla\Database\DatabaseQuery::set method. * * @return void * * @covers \Joomla\Database\DatabaseQuery::set * @since 1.0 */ public function testSet() { $this->assertThat($this->instance->set('foo = 1'), $this->identicalTo($this->instance), 'Tests chaining.'); $this->assertThat(trim(TestHelper::getValue($this->instance, 'set')), $this->identicalTo('SET foo = 1'), 'Tests set with a string.'); $this->instance->set('bar = 2'); $this->assertEquals("SET foo = 1" . PHP_EOL . "\t, bar = 2", trim(TestHelper::getValue($this->instance, 'set')), 'Tests appending with set().'); // Clear the set. TestHelper::setValue($this->instance, 'set', null); $this->instance->set(array('foo = 1', 'bar = 2')); $this->assertThat(trim(TestHelper::getValue($this->instance, 'set')), $this->identicalTo("SET foo = 1" . PHP_EOL . "\t, bar = 2"), 'Tests set with an array.'); // Clear the set. TestHelper::setValue($this->instance, 'set', null); $this->instance->set(array('foo = 1', 'bar = 2'), ';'); $this->assertThat(trim(TestHelper::getValue($this->instance, 'set')), $this->identicalTo("SET foo = 1" . PHP_EOL . "\t; bar = 2"), 'Tests set with an array and glue.'); }