Ejemplo n.º 1
0
 /**
  * Method to test format().
  *
  * @return void
  *
  * @covers Windwalker\Query\Query::format
  */
 public function testFormat()
 {
     $result = $this->instance->format('SELECT %n FROM %n WHERE %n = %a', 'foo', '#__bar', 'id', 10);
     $sql = 'SELECT ' . $this->instance->qn('foo') . ' FROM ' . $this->instance->qn('#__bar') . ' WHERE ' . $this->instance->qn('id') . ' = 10';
     $this->assertEquals($sql, $result);
     $result = $this->instance->format('SELECT %n FROM %n WHERE %n = %t OR %3$n = %Z', 'id', '#__foo', 'date');
     $sql = 'SELECT ' . $this->instance->qn('id') . ' FROM ' . $this->instance->qn('#__foo') . ' WHERE ' . $this->instance->qn('date') . ' = ' . $this->instance->expression('current_timestamp') . ' OR ' . $this->instance->qn('date') . ' = ' . $this->instance->nullDate(true);
     $this->assertEquals($sql, $result);
 }