Ejemplo n.º 1
0
 /**
  * Tests the JDatabaseQuery::format method.
  *
  * @return  void
  *
  * @since   12.3
  */
 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__ . '.');
 }