public function test_deleteTpl()
 {
     $instance = new $this->myclass($this->conn);
     $source = new XoopsTplFile();
     $source->setDirty();
     $source->setNew();
     $source->setVar('tpl_refid', 1);
     $source->setVar('tpl_lastmodified', 1);
     $source->setVar('tpl_lastimported', 1);
     $source->setVar('tpl_module', 'TPL_DESC_DUMMY_TEST');
     $source->setVar('tpl_tplset', 'TPL_DESC_DUMMY_TEST');
     $source->setVar('tpl_file', 'TPL_DESC_DUMMY_TEST');
     $source->setVar('tpl_desc', 'TPL_DESC_DUMMY_TEST');
     $source->setVar('tpl_type', 'TPL_DESC_DUMMY_TEST');
     $value = $instance->insertTpl($source);
     $this->assertSame(true, $value);
     $value = $instance->deleteTpl($source);
     $this->assertSame(true, $value);
 }
 /**
  * getTplObjects
  *
  * @param CriteriaElement|null $criteria  criteria to match
  * @param bool                 $getsource include the source
  * @param bool                 $id_as_key use the object id as array key
  *
  * @return array
  */
 public function getTplObjects(CriteriaElement $criteria = null, $getsource = false, $id_as_key = false)
 {
     $qb = $this->db2->createXoopsQueryBuilder();
     $eb = $qb->expr();
     $ret = array();
     if (!$getsource) {
         $qb->select('*')->fromPrefix('system_tplfile', 'f');
     } else {
         $qb->select('f.*')->addSelect('s.tpl_source')->fromPrefix('system_tplfile', 'f')->leftJoinPrefix('f', 'system_tplsource', 's', $eb->eq('s.tpl_id', 'f.tpl_id'));
     }
     if (isset($criteria) && $criteria instanceof CriteriaElement) {
         $criteria->renderQb($qb);
     }
     $result = $qb->execute();
     if (!$result) {
         return $ret;
     }
     while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
         $tplfile = new XoopsTplFile();
         $tplfile->assignVars($myrow);
         if (!$id_as_key) {
             $ret[] = $tplfile;
         } else {
             $ret[$myrow['tpl_id']] = $tplfile;
         }
         unset($tplfile);
     }
     return $ret;
 }