function _checkCountersConsistency($time)
 {
     $sql = 'SELECT SUM(hits) as hits_all, SUM(hosts) as hosts_all FROM stats_day_counters';
     $stmt =& $this->conn->newStatement($sql);
     $rs = new SimpleDbDataset($stmt->getRecordSet());
     $record1 = $rs->getRow();
     $rs =& $this->db->select('stats_counter', '*');
     $record2 = $rs->getRow();
     $this->assertEqual($record1['hits_all'], $record2['hits_all'], 'Counters all hits number inconsistent. ' . $record1['hits_all'] . ' not equal ' . $record2['hits_all']);
     $this->assertEqual($record1['hosts_all'], $record2['hosts_all'], 'Counters all hosts number inconsistent. ' . $record1['hosts_all'] . ' not equal ' . $record2['hosts_all']);
     $rs = $this->db->select('stats_day_counters', '*', array('time' => $this->register->makeDayStamp($time)));
     $record3 = $rs->getRow();
     $this->assertEqual($record3['hits'], $record2['hits_today'], 'Counters day hits number inconsistent. ' . $record3['hits'] . ' not equal ' . $record2['hits_today']);
     $this->assertEqual($record3['hosts'], $record2['hosts_today'], 'Counters day hosts number inconsistent. ' . $record3['hosts'] . ' not equal ' . $record2['hosts_today']);
 }
  function testFetch()
  {
    $this->db->insert('sys_object', array('oid' => $id1 = 10,
                                          'class_id' => $class_id1 = 50));

    $this->db->insert('sys_class', array('id' => $class_id1,
                                         'name' => $class_name1 = 'TestArticle'));

    $this->db->insert('sys_object', array('oid' => $id2 = 11,
                                          'class_id' => $class_id2 = 51));

    $this->db->insert('sys_class', array('id' => $class_id2,
                                         'name' => $class_name2 = 'TestDocument'));

    $dao = new ObjectsClassNamesDAO();
    $ids_arr = array($id1, $id2);
    $ids = implode(',', $ids_arr);
    $dao->addCriteria(new SimpleConditionCriteria("sys_object.oid IN ($ids)"));

    $rs = new SimpleDbDataset($dao->fetch());
    $arr = $rs->getArray('oid');
    $this->assertEqual($arr[$id1]['name'], $class_name1);
    $this->assertEqual($arr[$id2]['name'], $class_name2);
  }