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

class ProjectInDbTestCase extends KWWebTestCase
{
  var $url = null;
  var $db  = 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['pwd']);
   }
  
  function testCreateProject()
    {
    $content = $this->connect($this->url);
    if(!$content)
      {
      return;
      }
    $this->login();
    if(!$this->analyse($this->clickLink('[Create new project]')))
      {
      return;
      }
    
    $this->setField('name','ProjectTest');
    $this->setField('description','This is a project test for cdash');
    $this->setField('public','1');
    $this->clickSubmitByName('Submit');


    $query = "SELECT COUNT(*) FROM project";
    $result = $this->db->query($query);
    if( strcmp($this->db->getType(),"pgsql") == 0 && 
        $result[0]['count'] < 1)
      {
      $result = $result[0]['count'];  
      $errormsg = "The result of the query '$query' which is $result"; 
      $errormsg .= "is not the one expected: 1";
      $this->assertEqual($result,'1',$errormsg);
      return;
      }
    elseif(strcmp($this->db->getType(),"mysql") == 0 && 
           $result[0]['COUNT(*)'] < 1)
      {
      $result = $result[0]['COUNT(*)']; 
      $errormsg = "The result of the query '$query' which is $result"; 
      $errormsg .= "is not the one expected: 1";
      $this->assertEqual($result,'1',$errormsg);
      return;
      }
    
    $this->checkErrors();
    $this->assertText('The project ProjectTest has been created successfully.');
    }
  
    function testProjectTestInDatabase()
    {
    $query = "SELECT name,description,public FROM project WHERE name = 'ProjectTest'";
    $result = $this->db->query($query);
    $nameexpected = "ProjectTest";
    $descriptionexpected = "This is a project test for cdash";
    $publicexpected = 1;
    $expected = array('name'        =>  $nameexpected,
                      'description' =>  $descriptionexpected,
                      'public'      =>  $publicexpected);
    $this->assertEqual($result[0],$expected);
    }
  
  function testIndexProjectTest()
    {
    $content = $this->get($this->url.'/index.php?project=ProjectTest');
    $this->assertTitle('CDash - ProjectTest');
    }
  
  function testEditProject()
    {
    $content = $this->connect($this->url);
    if(!$content)
      {
      return;
      }
    $this->login();
    $projectid = $this->db->query("SELECT id FROM project WHERE name = 'ProjectTest'");
    $content = $this->connect($this->url.'/createProject.php?projectid='.$projectid[0]['id']);
    if(!$content)
      {
      return;
      }
//  $this->analyse($this->clickLink('[Edit project]'));
//  echo $this->analyse($this->setField('projectSelection','ProjectTest'));
    $description = $this->_browser->getField('description');
    $public      = $this->_browser->getField('public');
    $descriptionExpected = 'This is a project test for cdash';
    if(strcmp($description,$descriptionExpected) != 0)
      {
      $this->assertEqual($description,$descriptionExpected);
      return;
      }
    if(strcmp($public,'1') != 0)
      {
      $this->assertEqual($public,'1');
      return;
      }
    $content  = $this->analyse($this->clickLink('CTestConfig.php'));<commit_msg>ENH: Fixed naming issue<commit_after><?php
// kwtest library
require_once('kwtest/kw_web_tester.php');
require_once('kwtest/kw_db.php');

class ProjectInDbTestCase extends KWWebTestCase
{
  var $url = null;
  var $db  = 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>']);
   }
  
  function testCreateProject()
    {
    $content = $this->connect($this->url);
    if(!$content)
      {
      return;
      }
    $this->login();
    if(!$this->analyse($this->clickLink('[Create new project]')))
      {
      return;
      }
    
    $this->setField('name','ProjectTest');
    $this->setField('description','This is a project test for cdash');
    $this->setField('public','1');
    $this->clickSubmitByName('Submit');


    $query = "SELECT COUNT(*) FROM project";
    $result = $this->db->query($query);
    if( strcmp($this->db->getType(),"pgsql") == 0 && 
        $result[0]['count'] < 1)
      {
      $result = $result[0]['count'];  
      $errormsg = "The result of the query '$query' which is $result"; 
      $errormsg .= "is not the one expected: 1";
      $this->assertEqual($result,'1',$errormsg);
      return;
      }
    elseif(strcmp($this->db->getType(),"mysql") == 0 && 
           $result[0]['COUNT(*)'] < 1)
      {
      $result = $result[0]['COUNT(*)']; 
      $errormsg = "The result of the query '$query' which is $result"; 
      $errormsg .= "is not the one expected: 1";
      $this->assertEqual($result,'1',$errormsg);
      return;
      }
    
    $this->checkErrors();
    $this->assertText('The project ProjectTest has been created successfully.');
    }
  
    function testProjectTestInDatabase()
    {
    $query = "SELECT name,description,public FROM project WHERE name = 'ProjectTest'";
    $result = $this->db->query($query);
    $nameexpected = "ProjectTest";
    $descriptionexpected = "This is a project test for cdash";
    $publicexpected = 1;
    $expected = array('name'        =>  $nameexpected,
                      'description' =>  $descriptionexpected,
                      'public'      =>  $publicexpected);
    $this->assertEqual($result[0],$expected);
    }
  
  function testIndexProjectTest()
    {
    $content = $this->get($this->url.'/index.php?project=ProjectTest');
    $this->assertTitle('CDash - ProjectTest');
    }
  
  function testEditProject()
    {
    $content = $this->connect($this->url);
    if(!$content)
      {
      return;
      }
    $this->login();
    $projectid = $this->db->query("SELECT id FROM project WHERE name = 'ProjectTest'");
    $content = $this->connect($this->url.'/createProject.php?projectid='.$projectid[0]['id']);
    if(!$content)
      {
      return;
      }
//  $this->analyse($this->clickLink('[Edit project]'));
//  echo $this->analyse($this->setField('projectSelection','ProjectTest'));
    $description = $this->_browser->getField('description');
    $public      = $this->_browser->getField('public');
    $descriptionExpected = 'This is a project test for cdash';
    if(strcmp($description,$descriptionExpected) != 0)
      {
      $this->assertEqual($description,$descriptionExpected);
      return;
      }
    if(strcmp($public,'1') != 0)
      {
      $this->assertEqual($public,'1');
      return;
      }
    $content  = $this->analyse($this->clickLink('CTestConfig.cmake'));
{'fraction_non_alphanumeric': 0.19203254313367935, 'fraction_numerical': 0.005610885117127227, 'mean_word_length': 3.0146396396396398, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 118, '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': '1852146', 'n_tokens_mistral': 2267, 'n_tokens_neox': 2240, 'n_words': 398}