/** * Tests the \Joomla\Database\DatabaseQuery::format method. * * @return void * * @covers \Joomla\Database\DatabaseQuery::format * @since 1.0 */ public function testFormat() { $result = $this->instance->format('SELECT %n FROM %n WHERE %n = %a', 'foo', '#__bar', 'id', 10); $expected = 'SELECT ' . $this->instance->qn('foo') . ' FROM ' . $this->instance->qn('#__bar') . ' WHERE ' . $this->instance->qn('id') . ' = 10'; $this->assertThat($result, $this->equalTo($expected), 'Line: ' . __LINE__ . '.'); $result = $this->instance->format('SELECT %n FROM %n WHERE %n = %t OR %3$n = %Z', 'id', '#__foo', 'date'); $expected = 'SELECT ' . $this->instance->qn('id') . ' FROM ' . $this->instance->qn('#__foo') . ' WHERE ' . $this->instance->qn('date') . ' = ' . $this->instance->currentTimestamp() . ' OR ' . $this->instance->qn('date') . ' = ' . $this->instance->nullDate(true); $this->assertThat($result, $this->equalTo($expected), 'Line: ' . __LINE__ . '.'); }