<commit_before><?php
// kwtest library
require_once('kwtest/kw_web_tester.php');
require_once('kwtest/kw_db.php');

class UserStatisticsTestCase extends KWWebTestCase
{
  var $url           = null;
  var $db            = null;
  var $projecttestid = null;
  
  function __construct()
    {
    parent::__construct();
    require('config.test.php');
    $this->url = $configure['urlwebsite'];
    $this->db  =& new database($db['type']);
    $this->db->setDb($db['name']);
    $this->db->setHost($db['host']);
    $this->db->setUser($db['login']);
    $this->db->setPassword($db['<PASSWORD>']);
    $this->projectid = -1;
    }

  function testUserStatistics()
    {
    $this->login();
    $this->get($this->url."/userStatistics.php?projectid=1");
    
    // No project selected
    $this->get($this->url."/userStatistics.php");
    
    $this->post($this->url."/userStatistics.php?projectid=1", array("range"=>"lastweek"));
    $this->post($this->url."/userStatistics.php?projectid=1", array("range"=>"thismonth"));
    $this->post($this->url."/userStatistics.php?projectid=1", array("range"=>"lastmonth"));
    $this->post($this->url."/userStatistics.php?projectid=1", array("range"=>"thisyear"));
    }
}
?><commit_msg>COV: userstatistics.php<commit_after><?php
// kwtest library
require_once('kwtest/kw_web_tester.php');
require_once('kwtest/kw_db.php');

class UserStatisticsTestCase extends KWWebTestCase
{
  var $url           = null;
  var $db            = null;
  var $projecttestid = null;
  
  function __construct()
    {
    parent::__construct();
    require('config.test.php');
    $this->url = $configure['urlwebsite'];
    $this->db  =& new database($db['type']);
    $this->db->setDb($db['name']);
    $this->db->setHost($db['host']);
    $this->db->setUser($db['login']);
    $this->db->setPassword($db['<PASSWORD>']);
    $this->projectid = -1;
    }

  function testUserStatistics()
    {
    $this->login();
    $this->get($this->url."/userStatistics.php?projectid=1");
    
    // No project selected
    $this->get($this->url."/userStatistics.php");
    
    // Cover all date ranges
    $this->post($this->url."/userStatistics.php?projectid=1", array("range"=>"lastweek"));
    $this->post($this->url."/userStatistics.php?projectid=1", array("range"=>"thismonth"));
    $this->post($this->url."/userStatistics.php?projectid=1", array("range"=>"lastmonth"));
    $this->post($this->url."/userStatistics.php?projectid=1", array("range"=>"thisyear"));
    
    // Cover no user id case
    $this->logout();
    $this->$this->get($this->url."/userStatistics.php");
    }
}
?>
{'fraction_non_alphanumeric': 0.2229495571813631, 'fraction_numerical': 0.004620716211012707, 'mean_word_length': 3.793357933579336, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3687402', 'n_tokens_mistral': 883, 'n_tokens_neox': 882, 'n_words': 110}