Esempio n. 1
0
 public function testProccessQuery()
 {
     foreach ($this->_testObjects as $obj) {
         $this->object->setQuery($obj['query']['query']);
         $this->object->setParameters($obj['query']['parameters']);
         $this->object->setXslt($obj['query']['xslt']);
         if (isset($obj['query']['delimiter'])) {
             $this->object->setDelimiter($obj['query']['delimiter']);
         }
         $this->assertEquals($obj['result'], $this->object->proccessQuery());
     }
 }
Esempio n. 2
0
 /**
  * Sets query to perform.
  *
  * @param KBIQuery | int | string Query
  */
 function setQuery($value)
 {
     if ($value instanceof KBIQuery) {
         $this->query = $value;
         return $this;
     }
     if (is_numeric($value)) {
         if (!class_exists('KbiModelQueries')) {
             JLoader::import('queries', COM_KBI_ADMIN . DS . 'models');
         }
         $queries = new KbiModelQueries();
         $db = get_object_vars($queries->getQuery($value));
         $query = new KBIQuery();
         // TODO: implement all properties
         $query->setQuery($db['query']);
         $query->setDelimiter($db['delimiter']);
         $query->setXslt($db['paramsxsl']);
         $this->query = $query;
     } elseif (is_string($value)) {
         $query = new KBIQuery();
         $query->setQuery($value);
         $this->query = $query;
     }
     if ($this->query != NULL) {
         $query->setOptions($this->getOptions, 'GET');
         $query->setOptions($this->postOptions, 'POST');
         return $this->query->setParameters($this->getParams());
     }
     return $this;
 }